If you are using the Maven Cobertura plugin, you can specify filtering using two separate tags:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.version}</version>
<configuration>
<instrumentation>
<ignores>
<ignore>org.apache.log4j.*</ignore>
...
</ignores>
<excludes>
<exclude>**/package1/package2/**/*.class</exclude>
...
</excludes>
</instrumentation>
</configuration>
</plugin>
<ignores>
tells Cobertura to exclude all calls to the specified package/class. The example above will ignore all lines that are log4j logging calls.
<excludes>
tells Cobertura to not instrument certain files. Hits to those classes are not recorded during the test run. Here **
indicates recursive search (any directory at any depth below current). So the example states: Exclude any classes that have the package1.package2
package anywhere in their fully qualified name.
You also have an <includes>
to specify a white-list of classes instead of <excludes>
.
Other details can found here: Mojo's Maven plugin for Cobertura - Usage