Maven Clover Plug-in Build File

Maven utilizes Ant to provide users with an easy-to-use and familiar interface to manage projects that have been described with a valid Maven project descriptor. The build files that Maven installs are stored in ${maven.home} directory.

This document describes the Ant build file and targets that are available when using the Clover Plug-in with Maven.

The current recommended approach to using Maven is to add delegators to these Maven-provided targets in your project's main build file. This will enable you to use your existing build file with the additional Maven functionality. In addition, it is also recommended that you load a standard set of property files. The property files will setup your environment, ${lib.repo} and ${maven.home}, and allow you to override Maven defaults properties. Please refer to the Integration document for more information on how to integrate these build targets into your project.

The following table contains a brief overview of the build file that is installed as part of the Maven Clover Plug-in in the ${maven.home}/plugin/clover directory. In addition, the various Ant targets in this file is discussed.

Build FileDescription
build.xml Contains targets to generate Clover test coverage reports.

The build file utilizes various properties for default and user-configurable settings. All Clover Plug-in properties are described in the Properties document. The rest of this document assumes your project follows the standard Directory Layout; however, it is possible to override many of these defaults.

clover/build.xml

TargetDescription
maven:clover-testRuns unit tests on Clover-instrumented code and generates coverage data.
maven:clover-report-htmlGenerates HTML Clover Test coverage reports.
maven:clover-report-swingRun Clover Test coverage reports with the Swing viewer

maven:clover-test

This target instruments your code, runs your unit tests on it and generates a Clover database file. This target must be called prior to calling one of the report targets below.

Note : There is a limitation in Clover 0.5b. The test coverage results are written to Clover database on JVM shutdown only. Thus be careful to execute the maven:clover-test target separately from the maven:clover-report-* ones or the report will show a 0% coverage result! In other words, do not type "ant maven:clover-test maven:clover-report-*". Instead, do it in 2 JVM invocations : "ant maven:clover-tests" and "ant maven:clover-report-*".

maven:clover-report-html

Prior to running this target you should have called the maven:clover-test one which generates a test result database file. This target generates an HTML report from that database file. The report shows exactly what lines of your code were exercised by your tests.

maven:clover-report-swing

Prior to running this target you should have called the maven:clover-test one which generates a test result database file. This target runs a Swing viewer displaying the content of that database file.