View Source

!clover-summary.png|align=right!

|| Plugin Information || Hudson 2 || Hudson 3 ||
| *Plugin ID* | clover | clover |
| *Latest Release* | 4.1.0 | 4.6.1 |
| *Latest Release Date* | 15 Dec 2015 | 17 Oct 2016 |
| *Sources* | [Github|https://github.com/hudson2-plugins/clover-plugin] | [Github|https://github.com/hudson3-plugins/clover-plugin] |
| *Issue tracker* | [JIRA|https://jira.atlassian.com/browse/CLOV] | [JIRA|https://jira.atlassian.com/browse/CLOV] |


{hudson-plugin-info:pluginId=clover}


h1. About the plugin

{excerpt}This plugin allows you to capture code coverage reports from [Atlassian Clover|http://atlassian.com/software/clover/]. Hudson will generate and track code coverage across time. This plugin can be used without the need to modify your build.xml.
{excerpt}\\


h1. Installation

You can use the Hudson Plugin Manager to install this plugin automatically _(Manage Hudson > Manage Plugins > Available > search "clover")_

You can also download the HPI package from the OSS Sonatype repository:
* [https://oss.sonatype.org/content/repositories/releases/org/jvnet/hudson/plugins/clover|https://oss.sonatype.org/content/repositories/releases/org/jvnet/hudson/plugins/clover] for Hudson 1 and 2

* [https://oss.sonatype.org/content/repositories/releases/org/hudsonci/plugins/clover|https://oss.sonatype.org/content/repositories/releases/org/hudsonci/plugins/clover] for Hudson 3

and next install it manually _(Manage Hudson > Manage Plugins > Advanced > Manual Plugin Installation)_.
\\
{warning:title=IMPORTANT}The Clover Plugin for Hudson 3 (Clover plug-in version 4.0.6 and above) requires the JFreechart Plugin (org.hudsonci.plugins:jfreechart-plugin, version 1.4 or later) installed in Hudson.
{warning}




h1.








!clover-treemap.png|align=center!

h1. Automatic 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.


!clover-one-click.png|border=2!

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.

!Hudson.png|border=2!



\* most. we've not tested this on every Ant build ;-)

h1. Manual integration



h2. Manually Configuring Clover Plugin for Ant or Maven


# Install the clover plugin
# [Configure|http://confluence.atlassian.com/x/7oBEB] your project's build script to generate clover XML reports
# (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.
# Enable the "Publish Clover Coverage Report" publisher
# Specify the directory where the clover.xml report is generated.
# (Optional) Configure the coverage metric targets to reflect your goals.
!clover-config.gif|border=2!

h2. 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:_
* Create the job as a "free-style software project".
* Enable the "Invoke top-level Maven targets" Build.
* Specify the following goals for Maven: (Note the use of the pipe character \| to invoke maven three times).

{code}install
-Dmaven.test.failure.ignore=true
|
-Dclover.license.file=path-to-clover-license
clover:instrument
clover:aggregate
|
-Dclover.license.file=path-to-clover-license
-N
clover:aggregate
clover:clover
{code}\* Enable the "Publish Clover Coverage Report" publisher.
* Depending on your Source Code Management, the clover report directory will either be "target/site/clover" or "_module-name_/target/site/clover"
* Don't forget to configure the pom.xml to generate the clover.xml report
\\
{code}<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
...
<build>
...
<plugins>
...
<plugin>
<artifactId>maven-clover-plugin</artifactId>
...
<configuration>
...
<licenseLocation>${clover.license.file}</licenseLocation>
<generateHtml>true</generateHtml>
<generateXml>true</generateXml>
...
</configuration>
...
</plugin>
...
</plugins>
...
</build>
...
</project>
{code}

h2. 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:
{code}<project>
...
<profiles>
...
<profile>
<id>running-clover</id>
<activation>
<property>
<name>clover.license.file</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clover-plugin</artifactId>
<configuration>
<licenseLocation>${clover.license.file}</licenseLocation>
<generateHtml>true</generateHtml>
<generateXml>true</generateXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>not-running-clover</id>
<activation>
<property>
<name>!clover.license.file</name>
</property>
</activation>
<modules>
<module>my-ear-artifact</module>
<!-- list any other ear child modules here -->
</modules>
</profile>
...
</profiles>
...
</project>
{code}&nbsp;The above... hack... is why it is recommended to invoke maven three times.&nbsp; 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


h1. Version History

Note: code base for all Hudson plug-ins was split for Hudson2 and Hudson3:
* [https://github.com/hudson2-plugins]
* [https://github.com/hudson3-plugins]

Therefore, code base and version numbering for Hudson Clover Plug-in was split too.


| *Clover Plugin for Hudson 2* | *Clover Plugin for Hudson 3* |
| --- | *Version 4.6.1* 17 Oct 2016 \\
Fixed pom.xml to make plugin compatible with Hudson 3.0.0+ (instead of 3.3.2+). |
| --- | *Version 4.6.0* 12 Oct 2016 \\
Update plug-in to use Clover 4.1.2. New "Pass variables in double quotes" checkbox added. |
| *Version 4.1.0* 15 Dec 2015 \\
Update plug-in to use Clover 4.1.1. | *Version 4.5.0* 15 Dec 2015 \\
Update plug-in to use Clover 4.1.1. |
| *Version 4.0.0* 15 Jul 2014 \\
Update plug-in to use Clover 4.0.0. This major release brings new ADG HTML report.\\ | *Version 4.4.0* 15 Jul 2014 \\
Update plug-in to use Clover 4.0.0. This major release brings new ADG HTML report. |
| *Version 3.3.0* \\
Update plug-in to use Clover 3.3.0. This new major release supports Spock framework. | *Version 4.3.0* \\
Update plug-in to use Clover 3.3.0. This new major release supports Spock framework. |
| *Version 3.2.0* \\
Update plug-in to use Clover 3.2.0. This new major release supports Java8 language. | *Version 4.2.0* \\
Update plug-in to use Clover 3.2.0. This new major release supports Java8 language. |
| *Version 3.1.12* \\
Update plug-in to use Clover 3.1.12. | *Version 4.1.0* \\
Update plug-in to use Clover 3.1.12. \\ |
| | *Version 4.0.6-h-1* \\
Update plug-in to use _org.hudsonci.plugins:clover_ artifact name. Updated various URLs in pom.xml. \\
Plug-in is still based on Clover 3.1.5. |
\\
\\
*Older versions (common history):*

*Version 3.1.5*
* Update plug-in to use Clover 3.1.5

*Version 3.1.2*
* Update plug-in to use Clover 3.1.3

*Version 3.1.1*
* Update plug-in to use Clover 3.1.1

*Version 3.1.0*
* Update plug-in to use Clover 3.1.0



*Version 3.0.2*
* Fixed [NoStaplerConstructorException|http://issues.hudson-ci.org/browse/HUDSON-6769] with recent Hudson versions.
* Update to Clover 3.0.2.

*Version 3.0.1*
* Upgrade to Clover 3.0 which has Support for Groovy
* View [Release Notes|http://confluence.atlassian.com/display/CLOVER/Clover+3.0+Release+Notes]
* No other changes to the Hudson Clover plugin, apart from its dependency on Clover 3.0

*Version 2.6.3*
* This release is only compatible with Hudson: 1.339 and above.
* Compiled plugin against latest version of Hudson to fix: [NoSuchMethodError: hudson.util.DescribableList.add(Lhudson/model/Describable;)V|http://issues.hudson-ci.org/browse/HUDSON-5168]
* Bumped Clover version to 2.6.3 too.
*Version 2.5*
* support for specifying an optional Clover XML report filename


*Version 2.3*
* support for running builds on Windows
* updated Clover dependency to 2.6.1 to support IE6


*Version 2.2*
* minor bug fix

*Version 2.1*
* Scriptless integration for Ant Builds - no modifications to build.xml required - just check the "With Clover" checkbox.
* New bar-charts
* Clover HTML linked from each Build to make comparing changes in coverage easier

*Version 1.7*
* Clover processing runs before notifications run, to avoid inconsistency in the build status reporting ([1285@issue])

*Version 1.5 (17/08/2007)*
* Fixed a number of issues relating to rendering of the trend graph when there was no trend present.

h1. References

* [Clover Documentation Home|http://confluence.atlassian.com/display/CLOVER/Clover+Documentation+Home]

* [http://twitter.com/cloverallover]