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 maven-clover2-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">
<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: