Plugin Documentation

Goals available for this plugin:

Goal Report? Description
clover:aggregate No Aggregate children module Clover databases if there are any. This mojo should not exist. It's only there because the site plugin doesn't handle @aggregators properly at the moment...
clover:check No Verify Test Percentage Coverage (TPC) from an existing Clover database and fail the build if it is below the defined threshold. The check is done on main Clover databases and also on merged Clover databases when they exist.
clover:clean No The clover:clean goal should be run directly from the command line, when you are developing using the clover test runner optimizer. This mojo deletes the cloverOutputDirectory contents and the snapshot file used for test optimization.
clover:clover Yes Generate a Clover report from existing Clover databases. The generated report is an external report generated by Clover itself. If the project generating the report is a top level project and if the aggregate configuration element is set to true then an aggregated report will also be created.

Note: This report mojo should be an @aggregator and the clover:aggregate mojo shouldn't exist. This is a limitation of the site plugin which doesn't support @aggregator reports...

clover:instrument No

Fork a custom build lifecycle in which all sources will be instrumented by Clover and next execute this lifecycle till the install phase. All instrumented classes will be stored in a separate directory. Similarly, artifacts produced will have the 'clover' classifier.

This goal is forking a lifecycle because we don't want the Clover instrumentation to affect the main lifecycle build. This will prevent instrumented sources to be put in production by error. Thus running mvn install on a project where this instrument goal has been specified will run the build twice: once for building the project as usual and another time for instrumenting the sources with Clover and generating the Clover database.

Attention: Maven does not support multiple classifiers for an artifact. In case your project creates artifacts with classifiers, it may happen that the 'clover' classifier will be lost and an instrumented artifact will be installed as non-instrumented one.

Example: clover:instrument + jar:test-jar + install:install

    [INFO] --- maven-jar-plugin:2.6:test-jar (default) @ moneybags ---
    [INFO] Building jar: .../moneybags-1.0-SNAPSHOT-clover-tests.jar <<< file with double classifier was created
    [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ moneybags ---
    [INFO] Installing .../moneybags-1.0-SNAPSHOT-clover-tests.jar to
           ~/.m2/.../moneybags-1.0-SNAPSHOT-tests.jar <<< but 'clover' classifier was lost

In order to avoid this, you can use the instrument-test goal, which runs a forked lifecycle till the test phase.

clover:instrument-test No

This goal behaves exactly like the instrument goal, however when forking the lifecycle - it runs only to the 'test' phase instead of all the way to the 'install' phase.

This goal should be used as an optimization - ie. if the phases after 'test' take a very long time to run.

Instrument all sources using Clover and forks a custom lifecycle to execute project's tests on the instrumented code so that a Clover database is created.

clover:instrumentInternal No

Instrument source roots.

Note 1: Do not call this MOJO directly. It is meant to be called in a custom forked lifecycle by the other Clover plugin MOJOs.

Note 2: We bind this mojo to the "validate" phase so that it executes prior to any other mojos

clover:log No Provides information on the current Clover database.
clover:merge No Merge arbitrary number of clover databases into one. All databases must share a common root directory. Thankyou to Alex B.(dasmonsieur@gmail.com) for providing the basis of this mojo via: http://developer.atlassian.com/jira/browse/CLMVN-36
clover:optimize No Sets the 'test' property on the project which is used by the maven-surefire-plugin to determine which tests are run. If a snapshot file from a previous build, is found, that will be used to determine what tests should be run.
clover:optimizeIntegration No Sets the 'test' property on the project which is used by the maven-surefire-plugin to determine which tests are run. If a snapshot file from a previous build, is found, that will be used to determine what tests should be run.
clover:reset No No description.
clover:save-history No Save a Clover history point.
clover:setup No

This mojo is to be used mainly for incremental instrumentation and compilation of Java source code.

NB: This does not, nor should it, run in a forked lifecycle.

This mojo should certainly *not* be called during a release build. This mojo instruments your source and test files to ${build.directory}/clover/src-instrumented and test-src-instrumented respectively. These directories are then set as the project's source and test source directories that subsequently get compiled by the compiler MOJO.

clover:snapshot No Saves a Clover snapshot to the filesystem. A clover snapshot must be saved after all tests have been run. It is used by subsequent invocations of clover:optimize to determine which tests get run. Therefore, this file must persist between clean builds. This is possible by using one of the following techniques: 1) set the 'snapshot' (-Dmaven.clover.snapshot) configuration to a location outside the target directory 2) leave the snapshot file in the default location 'target/clover/clover.db.snapshot' and do a clean build with the clover:clean goal. clover:clean will delete everything the clean plugin does, however will ensure that the snapshot file does not get deleted.

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven 2.1.0
JDK 1.6
Memory No minimum requirement.
Disk Space No minimum requirement.

Usage

You should specify the version in your project's plugin configuration:

<project>
  ...
  <build>
    <!-- To define the plugin version in your parent POM -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.openclover</groupId>
          <artifactId>clover-maven-plugin</artifactId>
          <version>4.2.0</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
      <plugin>
        <groupId>org.openclover</groupId>
        <artifactId>clover-maven-plugin</artifactId>
        <version>4.2.0</version>
      </plugin>
      ...
    </plugins>
  </build>
  ...
  <!-- To use the report goals in your POM or parent POM -->
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.openclover</groupId>
        <artifactId>clover-maven-plugin</artifactId>
        <version>4.2.0</version>
      </plugin>
      ...
    </plugins>
  </reporting>
  ...
</project>

For more information, see "Guide to Configuring Plug-ins"