I am trying to generate code coverage report for our multi-module maven project using cobertura. After I run mvn clean and then run mvn package. Then, in one of the modules from where we run JUnit tests, the coverage report generated for that module is correct as expected. But the coverage is only for a few packages. Not all packages are covered. Remember it is a multi-module project with one parent POM and each child module having its own POM. Should I also include the cobertura maven plugin details in each of those child POMs ?
However, the individual module specific coverage report generated in the other /target/site/cobertura directories is reported as zero for both line coverage and branch coverage.
Am I missing something, in my parent POM ?, I have not made any changes to any of the child POMs in the directories. Please let me know how to generate the code coverage report for a multi module maven project using cobertura.
Here is how my parent POM looks like.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
<inherited>true</inherited>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
...
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<type>plugin</type>
<scope>package</scope>
</dependency>
</dependencies>
Thanks!