This plugin allows you to capture code coverage reports from Clover. Hudson will generate and track code coverage across time. This plugin can be used without the need to modify your build.xml.

Scriptless Integration for Ant Builds

Since version 2.0 of the Clover Plugin, Clover can be integrated into any* Ant build without the need to modify the build.xml .
Simply check the "Automatically record and report Code Coverage" checkbox in the Job configuration screen.

The Clover plugin will add an Ant BuildListener and appropriate configuration parameters to allow Clover HTML, XML, JSON and Historical reports to be generated for your Job.

These will automatically be linked to from the Job and Build pages.

The Clover License string can be configured either per-Job, or globally view the "Manage Hudson -> Configure System -> Manage Clover" screen.

* most. we've not tested this on every Ant build (wink)

 Manually Configuring Clover Plugin

  1. Install the clover plugin
  2. Configure your project's build script to generate clover XML reports
  3. (Optional) configure your project's build script to generate clover HTML or PDF reports (this plugin prefers HTML reports to PDF).  The plugin will not extract any information from these reports, but will use them as a better formatted most recent coverage report when they are available.
  4. Enable the "Publish Clover Coverage Report" publisher
  5. Specify the directory where the clover.xml report is generated.
  6. (Optional) Configure the coverage metric targets to reflect your goals.

Maven Configuration (with freestyle project)

The maven-clover-plugin is one of the plugins that highlights an issue with how Maven 2 handles aggregator goals.

Hudson cannot handle maven aggregator goals with the maven2 project (alpha) project type due to how this project type calls Maven.

In order to obtain multi-module clover reports, you must therefore use the free-style software project project type.  In any case, the hudson clover plugin does not currently support the maven2 project (alpha) project type.

In order to ensure that the correct aggregated report is generated, it is necessary to invoke maven multiple times.

Short answer:


Maven2, Clover and Multimodule with a <packaging>ear</packaging> child module

The maven2 ear packaging will break if you use the clover goal at any time during the same invokation of maven if you ivoke the package or later phases (as it will see artifacts without a classifier and with the clover classifier, get confused and give up)

To work around this, you should configurer your root pom to include the <packaging>ear</packaging> targets only when you are not using clover... how to do this:

        <!-- list any other ear child modules here -->

 The above... hack... is why it is recommended to invoke maven three times.  If you don't need this hack, you could simplify down to two invocations and specify the clover license file location in the pom.xml, i.e. install clover:instrument | -N clover:aggregate clove:site

Version History

Version 4.0.2 (question)

Version 4.0.1 (May 7, 2011)

Version 4.0

Jenkins 1.399 or later

Version 3.0.2

Version 3.0.1

Version 2.6.3

This release is only compatibly with Hudson: 1.339 and above.

Version 2.5

Version 2.4 (skipped)

Version 2.3

Version 2.2

Version 2.1

Version 1.7

Version 1.5 (17/08/2007)