Clover-for-Ant Two Line Integration

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

To get Clover integrated into your build as quickly as possible, follow these simple steps.

  1. Download Clover-for-Ant, unzip it, take the lib/clover.jar and save it in your home directory.

  2. Add the following lines to your build.xml file:

    <taskdef resource="cloverlib.xml" classpath="${user.home}/clover.jar"/>
    <clover-env/>
    

    (info) Note that this will not work within an Ant target. It must be at the top level of the build file.

  3. Add the clover.jar to your test classpath:

    <junit fork="true" forkmode="once">
      <classpath>
        <pathelement location="${user.home}/clover.jar"/>
      </classpath>
    </junit>
    
  4. If you have a target already called "test" you can simply run

    ant clover.all
    


    Otherwise, run the following:

    ant with.clover your.test.target clover.report
    

    Alternatively, define a property called "test.target" whose value is the name of your test target.

  5. Complete! That concludes the Ant two-line integration. You should now be set up to run Clover on your Ant builds and start taking advantage of Clover's advanced code coverage analysis.

 

 

Appendix

By calling <clover-env/>, the following targets becomes available to you:

Target Name

Description

clover.all

Runs clover.clean, with.clover, test, clover.report from a single target.

clover.clean

Deletes the clover database and the

${clover.dest}

directory.

clover.current

Generates an HTML and XML report to

${clover.dest}

using

${project.title}

.

clover.report

Same as clover.current, however a history report will also be created, using the historypoints in

${clover.project.historydir}

.

clover.save-history

Saves a history point to

${clover.project.historydir}

with.clover

Enables Clover on this build

clover.snapshot

Saves a snapshot file to assist with unit test optimization

(info) These are available also by running `ant -projecthelp`.

 

For more instructions about using targets, see the Clover Target Reference. Any ${} properties may be defined on the command line, for example: -Dclover.project.historydir=/home/clover/historydir

 

 

Need more information? Find it in the Clover QuickStart Guide.

Last modified on Jul 23, 2014

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.