6. Ant Task Reference

Installing the Clover Ant Tasks

Clover provides a set of Ant tasks to make project integration easy. To make these tasks available in your project build file, you need to:

  • load the 'cloverlib.xml' antlib by adding the following line to your build file:

    <taskdef resource="cloverlib.xml" classpath="/path/to/clover.jar"/>

Make sure you change the above "/path/to/clover.jar" to point directly to your clover.jar.

For further options, see also Ant Installation Options.

The tasks


Installs Clover as the Ant build.compiler. This means that Clover will be invoked whenever the Ant <javac> is used, resulting in instrumented compilation.


Allows manual instrumentation of source files, for cases where the normal <clover-setup> integration approach can't be used.


Produces coverage reports in different formats.


Generates a HTML report with default settings.


Generates a PDF report with default settings.


Records a coverage history point for use in historical coverage reports.
<clover-snapshot> Generates a snapshot file used to assist Clover in optimizing the tests run in subsequent build.


Merges several Clover databases into one, to allow for combined reports to be generated.


Tests project/package code coverage against criteria, optionally failing the build if the criteria are not met.


Reports coverage results to the console at various levels.


Deletes the coverage database and/or associated coverage records.


This task imports several useful Ant targets that can help you quickly integrate Clover into many common Ant builds.