Home » Java » java – Using singleCloverDatabase flag for code coverage-Exceptionshub

java – Using singleCloverDatabase flag for code coverage-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have a multi-module project. For generating coverage reports I am using clover plugin for maven. I was using the aggregate goal of clover plugin to generate reports for all modules and then aggregate them. But when I see the coverage reports I can see some classes were reported to have 0 coverage. These classes are generally present in a module different from the module where the test resides.
This is the command I am using

mvn clean compile clover:instrument clover:aggregate clover:clover

I came across this question on atlassian forums and the answer suggests that in this case the singleCloverDatabase flag should be used to just create one single clover db instead of creating one each for the sub modules and then aggregating them. But I am not sure how this is to be used. I am using this command at the root

mvn clean compile clover:instrument clover:clover

and my pom configuration for clover is this-

 <plugin>
          <groupId>org.openclover</groupId>
          <artifactId>clover-maven-plugin</artifactId>
          <version>4.3.1</version>
          <configuration>
            <singleCloverDatabase>true</singleCloverDatabase>
          </configuration>
 </plugin>

Once it finishes I can’t see reports under root/target/site. All I can see is a clover directory which has an index.html file that looks like this.

enter image description here

Am I doing something wrong?

EDIT– It stored the report in target folder of the module which was compiled last but I still don’t see the coverage for classes across modules.

How to&Answers: