Clover Plugin

Skip to end of metadata
Go to start of metadata

Plugin Information

Plugin ID clover Changes In Latest Release
Since Latest Release
Latest Release
Latest Release Date
Required Core
Dependencies
4.4.0 (archives)
Jul 18, 2014
1.509.2
Source Code
Issue Tracking
Maintainer(s)
GitHub
Open Issues
Nick Pellow (id: npellow)
Olivier Lamy (id: olamy)
Usage Installations 2014-Apr 2166
2014-May 2115
2014-Jun 2165
2014-Jul 2222
2014-Aug 2231
2014-Sep 2315
2014-Oct 2316
2014-Nov 2294
2014-Dec 2312
2015-Jan 2355
2015-Feb 2431
2015-Mar 2515

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

Automatic integration for Ant builds

Since version 2.0 of the Clover Plugin, Clover can be integrated into Ant-based builds 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 build listener 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 Jenkins -> Configure System -> Manage Clover" screen.

It works for typical build configurations in which unit tests are launched after compilation. In case you spawn processes, run in-container tests, deploy application to another machine etc then the automatic integration will not be sufficient and you'll have to set up integration manually.

Clover documentation

We recommend reading the official Clover Documentation home page - you will find instructions how to integrate Clover with Ant, Maven, Grails and other tools.

In case of trouble, you may have a look at the Atlassian Answers page (questions tagged 'clover').

Manually configuring the 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-clover2-plugin is one of the plugins that highlights an issue with how Maven 2 handles aggregator goals.

Jenkins 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 Jenkins 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).
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
  • 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
    <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      ...
      <build>
        ...
        <plugins>
          ...
          <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-clover2-plugin</artifactId>
            ...
    	<configuration>
              ...
              <licenseLocation>${clover.license.file}</licenseLocation>
              <generateHtml>true</generateHtml>
              <generateXml>true</generateXml>
              ...
            </configuration>
            ...
          </plugin>
          ...
        </plugins>
        ...
      </build>
      ...
    </project>
    

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:

<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>

 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.4.0 (July 18, 2014)

  • Upgrade to new major Clover release which is 4.0.0. This release comes with a completely redesigned HTML report, following the ADG (Atlassian Design Guidelines).

Version 4.3.0 (April 1, 2014)

  • Upgrade to new major Clover release which is 3.3.0. This release comes with a dedicated support for Spock framework JUnit4 parameterized tests.

Version 4.2.0 (October 23, 2013)

  • Upgrade to new major Clover release which is 3.2.0. This release supports instrumentation of Java 8 language. 

Version 4.1.0 (August 13, 2012)

  • Upgrade to Clover 3.1.12.1

Version 4.0.6 (May 13, 2012)

  • Upgrade to Clover 3.1.5

Version 4.0.5 (Jan 18, 2012)

Version 4.0.4 (Nov 8, 2011)

Version 4.0.2 (Jun 6, 2011)

Version 4.0.1 (May 7, 2011)

  • Clover plugin uses HTML in display name (issue #9435).

Version 4.0

  • Jenkins 1.399 or later
  • fixed the icon path on configuration pages (issue #7795).
  • Clover Coverage Trend Report Stop Displaying For Failed Build (issue #3918).
  • Ignore 0/0 Conditional in coverage graph (issue #8198).
  • i18n & i10n(ja)

Version 3.0.2

Version 3.0.1

  • Upgrade to Clover 3.0 which has Support for Groovy
  • View Release Notes
  • No other changes to the Hudson Clover plugin, apart from its dependency on Clover 3.0

Labels

clover clover Delete
plugin-report plugin-report Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 28, 2010

    Peter Kreidermacher says:

    Hello, I have Clover set up in a m2 style project in Hudson. The setup wasn't t...

    Hello,

    I have Clover set up in a m2 style project in Hudson. The setup wasn't too difficult and it seems to work on the two that I did.

    All that needs to be added to the pom is this:

    <plugin>
         <groupId>com.atlassian.maven.plugins</groupId>
         <artifactId>maven-clover2-plugin</artifactId>
         <version>3.0.2</version>
         <configuration>
              <licenseLocation>${maven.clover.licenseLocation}</licenseLocation>
              <generateHtml>true</generateHtml>
              <generateXml>true</generateXml>
         </configuration>
    </plugin>
    

    Then configure the projects "Goals and options" with this:

    -Dmaven.clover.licenseLocation=path/to/clover.license clover2:setup install clover2:aggregate clover2:clover

    Then simply select to Public Clover Coverage Reports just like the other setups.

    Since it is possible to run these with m2 projects, would it be possible to get a link to the reports put on the main page menu of an m2 projects like they are for freestyle projects?

    Thanks,

    Peter

  2. Nov 14, 2010

    Anirudhsinh Zala says:

    Recently we have started to use this plugin. But we have found 2 problems with t...

    Recently we have started to use this plugin. But we have found 2 problems with this. 1: issue #5881 and 2: "Coverage Breakdown by Package" have some links on columns but they are not expanded. Seems YUI related issue?

  3. May 22, 2013

    Hari MAHENDRAKUMAR says:

    Is there a way to display code coverage % on jenkins dashboard page itself ? It ...

    Is there a way to display code coverage % on jenkins dashboard page itself ? It would be nice to see that number (along side build status )without having to open each project separately to find out what it is. 

  4. Apr 11, 2014

    Devsh sharma says:

    i am getting this error ERROR: Publisher hudson.plugins.clover.CloverPublisher a...

    i am getting this error ERROR: Publisher hudson.plugins.clover.CloverPublisher aborted due to exception
    java.lang.NullPointerException
    at hudson.plugins.clover.CloverCoverageParser.trimPaths(CloverCoverageParser.java:31)
    at hudson.plugins.clover.CloverCoverageParser.parse(CloverCoverageParser.java:54)
    at hudson.plugins.clover.CloverPublisher.processCloverXml(CloverPublisher.java:202)
    at hudson.plugins.clover.CloverPublisher.perform(CloverPublisher.java:163)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:725)
    at hudson.model.Run.execute(Run.java:1701)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:231)

    Notifying upstream projects of job completion

  5. Sep 04, 2014

    Nicholas Key says:

    It seems like the "Clover XML Location" and "Clover HTML report directory" do no...

    It seems like the "Clover XML Location" and "Clover HTML report directory" do not honor placeholders (parameters) such as

    ${MY_PARAMETER}

    I tried using

    ${MY_PARAMETER}/tests/coverage/coverage.xml

    but it didn't get translated to the actual value assigned to the parameter.
    This could be a very useful feature.
    thank you!

    1. Sep 19, 2014

      Arun Kumar Paraman says:

      Yes, Report directory is not resolving the Parameters and Environments variable....

      Yes, Report directory is not resolving the Parameters and Environments variable.

      ${parameters}
      
       ${ENV['keys']}
      

      Either way it is not getting resolved.