You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

This page contains the installation instructions for Clover-for-Maven 2. On this page:

To use Clover with a Maven 2 project you will need to make a small change to your pom.xml.

  1. Set up your pom.xml by adding:
    pom.xml
    <build>
        <plugins>
            ...
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-clover2-plugin</artifactId>
                <version>${clover.version}</version>
            </plugin>
        </plugins>
    </build>
    


    (info) Either change ${clover.version} to the current Clover version, or define a property in your pom.xml that sets this value.

    (warning) Clover ships with a 30 day evaluation license. After 30 days you need a valid Clover license file to run Clover. You can obtain a free 30 day evaluation license or purchase a commercial license at http://my.atlassian.com. You will need to set up your licence, as a <licenseLocation> element in your pom.xml configuration file.

  2. Now, simply invoke Clover with Maven on the command line. This will instrument your sources, build your project, run your tests and create a Clover coverage database.

    There are three basic parts executed when recording code coverage with Clover.

    a. The clover2:setup goal will instrument your Java source files.
    b. The test phase is Maven 2's standard command for running a unit test phase.
    c. The clover2:clover goal generates an HTML, XML, PDF or JSON report.

    (info) The command clover2:aggregate goal is used for merging coverage data generated by multi-module projects.


    Now run the following command:
    mvn clover2:setup test clover2:aggregate clover2:clover
    
    which will create a coverage report. The coverage report will be created in this directory:
    target/site/clover
    

    Clover should now be fully set up for basic operation.

For more license configuration options, see the FAQ pages.

For more instructions, see the Clover-for-Maven 2 User's Guide.

  • No labels