|
I voted for this. It's kind of silly that we had to start using the previous version. Our experience is that it also always shows the branch coverage as N/A. Ok so I downloaded the plugin source code and found this interesting comment in class CoberturaInstrumentMojo // Old, Broken way /* New, Fixed way.
I then applied the patch from the mentioned issue to Cobertura 1.8, recompiled and copied the patched cobertura.jar into my local Maven repository. Surely enough that fixed the problem. Basically the Maven plugin v2.1 requires a patched version of Cobertura 1.8. Maybe this patched version should be made available in the Maven repository? (Ideally that should have been done before releasing the plugin...) As a temporary, unofficial, unsupported, use-at-your-own-risk workaround I made available a patched version of Cobertura 1.8 - built as explained above - here http://www.artofsolving.com/files/m2/cobertura-1.8.jar You can copy it in your local repository, overriding the one retrieved from the official maven repository. For those of you out there still on JDK here's a version that was built with 1.4: http://dist.codehaus.org/mule/dependencies/maven2/cobertura/cobertura/1.8/cobertura-1.8.jar There are other projects that have public cobertura reports that have this problem. For a live example see the PMD plugin! http://maven.apache.org/plugins/maven-pmd-plugin/cobertura/index.html Thanks, I'm using 2.0 now, thanks for the tip. Paul Sundling I'm experiencing the same problem. Unfortunately i'm also unable to switch to 2.0 because of the multi-project problems. Cannot try the cobertura patch since I won't dirty my repo. I'll vote for this issue! I have developed a patch to the cobertura-maven-plugin that fixes the original problem, and works with the released Cobertura 1.8 (ie. it does NOT require a patched Cobertura). The trick is that the plugin needs to configure the Maven Surefire plugin's "systemProperties" property. As a workaround for anyone that doesn't want to patch anything, the following snippet in your POM will get Cobertura working properly with the standard released versions of everything: <build> Thanks Peter. Setting net.sourceforge.cobertura.datafile worked for me. Cheers Sean. Setting net.sourceforge.cobertura.datafile worked for me too. Thanks a lot! Setting net.sourceforge.cobertura.datafile worked for me too. Peter - just want to chime in with my thanks, too. Your fix worked perfectly for me. Can someone please attach a test project that can be used to reproduce this problem. I've attached a simple maven project (cobertura-test.zip) that demonstrates the released cobertura plugin's incorrect behaviour. Uncomment the surefire-plugin configuration in the pom to see the workaround in action. Thanks for the project Peter. Here are my findings using it together with Maven 2.0.4, Java 1.4.2_16 and Win XP SP2. I tried different versions of the cobertura-plugin to see how they compared: maven-cobertura-plugin 2.0: 53% coverage To me it seems as if this issue has been resolved in the latest code available in trunk. I have test failures locally, but I have gone ahead and deployed a new 2.2-SNAPSHOT anyway, using "-Dmaven.test.skip=true". Please give it a try in your respective environments. Post the results here. Thanks Dennis. Same results for me, with Maven 2.0.4, Java 1.5.0_07 and Win XP SP2. 2.2-SNAPSHOT is working now because cobertura 1.9 has been released which reads the cobertura.properties file as required - so the next release of maven-cobertura-plugin will fix this issue. Thanks for verifying that Peter. |
||||||||||||||||||||||||||||||||||||||||||||||
It also looks like the 2.1 HTML report also does not contain enough classes.