Configuring reports

Choosing Report Formats

The clover:clover goal generates an HTML and an XML report by default. You can use the generateHtml, generatePdf, generateXml and generateJson configuration elements to choose which report formats should be produced:


(lightbulb) You may need to run clover:aggregate or clover:merge goals before running clover:clover.

Getting Information about your Clover Database

The clover:log goal will summarize your Clover database.

Generating Historical Reports

To include the generation of historical reports in your Clover reports, add the generateHistorical element to your Clover plugin configuration:


That will include your historical savepoints, if any, in the generated report.

To generate a savepoint, run the clover:save-history goal.

To avoid having mvn clean remove your savepoints you may want to set the location of the history directory (default location is $, for example:



Creating consolidated reports

In order to create a consolidated report for multiple modules or projects, you have to merge databases first. You can use clover:aggregate or clover:merge goal, followed by the clover:clover one. Example:

mvn clean clover:setup test clover:aggregate clover:clover


カスタム レポートを作成する

It is possible to define an external clover report descriptor file, the same way one can define a site.xml descriptor file. The descriptor file is basically a stripped down Ant file which will be run to produce the reports. All options available in clover-report can be specified. The default report descriptor used by the clover-maven-plugin is:
<project name="Clover Report" default="current">

    <clover-format id="clover.format" type="${type}" orderBy="${orderBy}" filter="${filter}"/>
    <clover-setup initString="${cloverdb}"/>

    <clover-columns id="clover.columns">
        <uncoveredElements format="raw"/>
        <totalPercentageCovered format="longbar"/>

    <target name="historical">
            <current outfile="${output}"  summary="${summary}">
                <format refid="clover.format"/>
                <testsources dir="${tests}"/>
                <columns refid="clover.columns"/>
            <historical outfile="${historyout}" historydir="${history}">
                <format refid="clover.format"/>
                <columns refid="clover.columns"/>

    <target name="current">
            <current outfile="${output}" title="${title}" summary="${summary}">
                <format refid="clover.format"/>
                <testsources dir="${tests}"/>
                <columns refid="clover.columns"/>


This is a very simple Ant file, which defines two known targets: "historical" and "current" .
If there are no history points saved (via: clover:save-history) then only the "current" target will be called. Otherwise, the "historical" target gets called which generates both a historical and current report which are linked together.

To change Clover's default reporting behavior, it is easiest to copy this file and add the changes you require. For a full list of clover-report elements and attributes, please consult the clover-report documentation.

This file can be stored either on your local file system, or in your maven repository as a classified artifact.

If stored on the file system, set this system property:


or specify this element:


in the <configuration> element for the clover-maven-plugin in your pom.xml.

If you wish to keep this descriptor in your maven repository you must specify this system property:


or set this element:


in the <configuration> element for the clover-maven-plugin in your pom.xml.
The descriptor should be deployed using the "clover-report" classifier. For example:

mvn deploy:deploy-file -DartifactId=my-artifact-id -Dversion=X.X -Dclassifier=clover-report \
 -Dpackaging=xml -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Properties for Custom Reports

Standard Maven properties

A custom clover report descriptor can access the standard Maven 2 and 3 properties. The following properties are available:

  • project.url
  • project.version
  • project.description
  • project.groupId
  • project.inceptionYear

In addition to these properties, any additional properties defined in pom.xml will also be available.

Clover configuration properties

Configuration options defined for clover:clover MOJO are available in report descriptor under following names:

  • ${cloverdb} = full path to Clover database, depending on settings:
    • default database location (<build directory>/clover/clover.db) or
    • maven.clover.cloverDatabase or 
    • maven.clover.cloverMergeDatabase
  • ${output} = full path to report directory or file:
    • absolute path of maven.clover.outputDirectory (HTML/JSON reports) or
    • maven.clover.outputDirectory + "/clover.pdf" (PDF report) or
    • maven.clover.outputDirectory + "/clover.xml" (XML report)
  • ${history} = maven.clover.historyDir
  • ${title} = report title, one of:
    • maven.clover.title or 
    • project's artifactId + version
    • in case when maven.clover.cloverMergeDatabase is set then the "(Aggregated)" word is appended
  • ${titleAnchor} = maven.clover.titleAnchor
  • ${projectDir} = project base dir
  • ${testPattern} = "**/src/test/**"
  • ${filter} = maven.clover.contextFilters
  • ${orderBy} = maven.clover.orderBy
  • ${charset} = maven.clover.charset
  • ${type} = html / pdf / xml / json 
    • depends on maven.clover.generateHtml / maven.clover.generatePdf / maven.clover.generateXml / maven.clover.generateJson
    • custom report will be run for each of types enabled
  • ${reportStyle} = style of the report ("adg" / "classic") - since Clover 4.0
  • ${span} = maven.clover.span
  • ${alwaysReport} = maven.clover.alwaysReport
  • ${summary} = whether to generate a summary, true for PDF report
  • ${historyout} = location of history report
    • ${output} for HTML
    • ${output}/historical.pdf for PDF



最終更新日 2016 年 7 月 14 日




Powered by Confluence and Scroll Viewport.