Maven Site Docs
For documentation presented in the standard Maven format, see the Maven Site Docs.
On this page:
|Table of Contents|
The quickest and easiest way to try Clover is from the command line, for example:
mvn clover2:setup test clover2:aggregate clover2:clover
Install Clover-for-Maven 2 and 3 by adding it to your Maven 2 and 3 build file (pom.xml):
You can also have Clover run as part of your build. Learn how.
There are three basic parts executed when recording code coverage with Clover.
The command clover2:aggregate goal is used for merging coverage data generated by multi-module projects.
Hence, if you use the following code:
This will create a coverage report, which will be created in this directory:
Clover should now be fully set up for basic operation.
For more license configuration options, see the FAQ pages.
Checking a Coverage Goal
You can check that your test coverage has reached a certain threshold, and fail the build if it has not by adding a
targetPercentage tag to your plugin configuration in
If you omit this
version element, the GMaven Plugin will default to using Groovy version 1.6.0, which is not compatible with Clover.
... <plugins> ... <plugin> <groupId>org.codehaus.groovy.maven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.0-rc-5</version> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>1.6.2</version> </dependency> </dependencies> <executions> <execution> <goals> <goal>generateStubs</goal> <goal>compile</goal> <goal>generateTestStubs</goal> <goal>testCompile</goal> </goals> </execution> </executions> </plugin> ... </plugins> ...
To do so, set up your .m2/settings.xml by adding:
... <pluginGroups> <pluginGroup>com.atlassian.maven.plugins</pluginGroup> </pluginGroups> ...