Configuring Cobertura in Maven 2
After many spurious error messages, I finally managed to make it work. Be warned that the information on the official Cobertura Maven plugin page, the informations are not exactly correct. Below, you’ll find in bold the fixes.
The “Basic Cobertura Configuration” seems fine, however, to configure the instrumentation, you need to add the following to your config file:
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.1</version> <!-- apparently, this is not necessary in the reporting part -->
<configuration>
<instrumentation>
<!-- <ignore>com.example.boringcode.*</ignore> --> <!-- not sure how to make this work, or even if it is necessary at all -->
<excludes> <!-- the usual ant exclude pattern was missing -->
<exclude>com/example/dullcode/**/*.class</exclude>
<exclude>com/example/**/*Test.class</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
