To get started with Clover-for-Maven, carry out the following steps.
Add org.openclover in .m2/settings.xml
Before you get started, add this to your
.m2/settings.xml file so you can reference
Clover by its short name
Run Clover goals from a command line
The quickest and easiest way to try Clover is from the command line:
- clean - to ensure that all sources will be recompiled (Clover uses source-code instrumentation)
- clover:setup - to initialize Clover and instrument sources
- test - to compile code, run tests and record code coverage
- clover:aggregate - to merge coverage data from a multi-module project
- clover:clover - to generate HTML report for a project
You can find a report in
For more instructions, see the Clover-for-Maven User's Guide.
For documentation presented in the standard Maven format, see the Maven Site Docs.
No coverage data?
Clover uses source code instrumentation, which means that source files must be recompiled with the 'clover:setup' goal. Ensure that you're building your project from scratch (call 'mvn clean' or do the fresh checkout). Otherwise, Maven may find your old, non-instrumented classes from a previous build and do not compile sources.
Still no coverage data?
In case you run in-container tests (e.g. using maven-cargo-plugin) or spawn new JVM processes or run tests of an application running on a remote server, you may need to add Clover's runtime JAR (com.atlassian.clover:clover) to a class path. See NoClassDefFoundError and Using Clover for web applications.
Out of memory?
Please keep in mind that Clover adds extra instructions to your classes measuring code coverage. Thus, increasing PermGen size may be necessary. See OutOfMemoryError: PermGen space.