Problems with Cobertura Maven plugin
Posted by doubleA on January 24, 2007
The cobertura-maven-plugin was updated in early January to version 2.2. This version has caused problems with the coverage testing because 2 .ser files are created – one during instrumentation and one during testing. This causes a 0% coverage rate because cobertura isn’t putting all information into the same .ser file.
There are several posts on the issue and a possible workaround:
http://www.mail-archive.com/users@maven.apache.org/msg58559.html
https://sourceforge.net/tracker/index.php?func=detail&aid=1543280&group_id=130558&atid=720017
My fix was to backlevel the plugin to the working 2.1 version. When defining the plugin in the build and reporting sections add a version tag to manually set the version to 2.1.
This obviously isn’t a long term solution, but it will work until the 2.2 plugin and Cobertura 1.8 work correctly with Maven.
Joe said
What is the stable cobertura plugin that i could include in my maven2 pom.xml’s to be able to generate the code coverage and also publish the same on the site. Cobertura 2.2 plugin seems to be broken. I see that 2.0 and 2.1 version of cobertura do not publish the code coverage results to the dashboard or (mvn site).
doubleA said
Joe, I’m using Cobertura 1.9 via the cobertura-maven-plugin from org.codehaus.mojo. In order to get the reports built during the build, you have to setup the plugin in the reporting section of your pom.
<plugin
<groupId>org.codehaus.mojo
<artifactId>cobertura-maven-plugin
</plugin
I have removed some of the XML formatting so that it shows correctly in the comments.