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

<clover-setup>

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

<clover-instr>

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

<clover-report>

Produces coverage reports in different formats.

<clover-html-report>

Generates a HTML report with default settings.

<clover-pdf-report>

Generates a PDF report with default settings.

<clover-historypoint>

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.

<clover-merge>

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

<clover-check>

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

<clover-log>

Reports coverage results to the console at various levels.

<clover-clean>

Deletes the coverage database and/or associated coverage records.

<clover-env>

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