The clover2: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:
<configuration> ... <generatePdf>true</generatePdf> <generateXml>true</generateXml> <generateHtml>false</generateHtml> <generateJson>false</generateJson> </configuration>
You may need to run clover2:aggregate or clover2:merge goals before running clover2:clover.
The clover2:log goal will summarize your Clover database.
To include the generation of historical reports in your Clover reports, add the generateHistorical element to your Clover plugin configuration:
<configuration> ... <generateHistorical>true</generateHistorical> </configuration>
That will include your historical savepoints, if any, in the generated report.
To generate a savepoint, run the clover2:save-history goal.
To avoid having mvn clean remove your savepoints you should set the location of the history directory, which defaults to $project.build.directory/clover/history:
<configuration>
...
<historyDir>${user.home}/history/${project.artifact}</historyDir>
</configuration>
<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">
<totalChildren/>
<avgMethodComplexity/>
<uncoveredElements format="raw"/>
<totalPercentageCovered format="longbar"/>
</clover-columns>
<target name="historical">
<clover-report>
<current outfile="${output}" summary="${summary}">
<format refid="clover.format"/>
<testsources dir="${tests}"/>
<columns refid="clover.columns"/>
</current>
<historical outfile="${historyout}" historydir="${history}">
<format refid="clover.format"/>
<columns refid="clover.columns"/>
</historical>
</clover-report>
</target>
<target name="current">
<clover-report>
<current outfile="${output}" title="${title}" summary="${summary}">
<format refid="clover.format"/>
<testsources dir="${tests}"/>
<columns refid="clover.columns"/>
</current>
</clover-report>
</target>
</project>
This is a very simple Ant file, which defines two known targets: "historical" and "current" .
If there are no history points saved (via: clover2: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:
-Dmaven.clover.reportDescriptor=/path/to/clover-report.xml
or specify this element:
<reportDescriptor>/path/to/clover-report.xml</reportDescriptor>
in the <configuration> element for the maven-clover2-plugin in your pom.xml.
If you wish to keep this descriptor in your maven repository you must specify this system property:
-Dmaven.clover.resolveReportDescriptor=true
or set this element:
<resolveReportDescriptor>true</resolveReportDescriptor>
in the <configuration> element for the maven-clover2-plugin in your pom.xml.
The descriptor should be deployed using the "clover-report" classifier. For example:
mvn deploy:deploy-file -DgroupId=my.group.id -DartifactId=my-artifact-id -Dversion=X.X -Dclassifier=clover-report \ -Dpackaging=xml -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
A custom clover report descriptor can access the standard Maven 2 and 3 properties. The following properties are available:
project.urlproject.versionproject.nameproject.descriptionproject.idproject.groupIdproject.inceptionYearIn addition to these properties, any additional properties defined in pom.xml will also be available.
Configuration options defined for clover2:clover MOJO are available in report descriptor under following names: