clover2:instrument

Full name:

com.atlassian.maven.plugins:maven-clover2-plugin:3.1.5:instrument

Description:

Instrument all sources using Clover and forks a custom lifecycle to execute project's tests on the instrumented code so that a Clover database is created.

Note: We're forking a lifecycle because we don't want the Clover instrumentation to affect the main lifecycle build. This will prevent instrumented sources to be put in production by error. Thus running mvn install on a project where this instrument goal has been specified will run the build twice: once for building the project as usual and another time for instrumenting the sources with Clover and generating the Clover database.

Attributes:

  • Requires a Maven 2.0 project to be executed.
  • Invokes the execution of the lifecycle phase install prior to executing itself.
  • Executes in its own lifecycle: clover.

Required Parameters

Name Type Since Description
cloverMergeDatabase String - The location of the merged clover database to create when running a report in a multimodule build. Default value is: ${project.build.directory}/clover/cloverMerge.db.
cloverOutputDirectory String - The directory where the Clover plugin will put all the files it generates during the build process. For example the Clover plugin will put instrumented sources somewhere inside this directory. Default value is: ${project.build.directory}/clover.
project MavenProject - The Maven project instance for the executing project.

Note: This is passed by Maven and must not be configured by the user.

Optional Parameters

Name Type Since Description
cloverDatabase String - The location of the Clover database.
debug boolean - If you wish to enable debug level logging in just the Clover plugin, set this to true. This is useful for integrating Clover into the build Default value is: false.
flushInterval int - When the Clover Flush Policy is set to "interval" or threaded this value is the minimum period between flush operations (in milliseconds). Default value is: 500.
flushPolicy String - The Clover flush policy to use. Valid values are directed, interval and threaded. Default value is: threaded.
jdk String - Whether the Clover instrumentation should use the Clover jdk14, jdk15, jdk16 or jdk17 flags to parse sources. Valid values are 1.4, 1.5, 1.6 and 1.7 .
license String - The full Clover license String to use. If supplied, this certificate will be used over licenseLocation. NB. newline chars must be preserved. A trial Clover license can be generated here.
licenseLocation String - A Clover license file to be used by the plugin. The plugin tries to resolve this parameter first as a resource, then as a URL, and then as a file location on the filesystem. A trial Clover license can be generated here.
singleCloverDatabase boolean - If true, then a single cloverDatabase will be used for the entire project. This flag will be ignored if a custom cloverDatabase location is specified. Default value is: false.
skip boolean - A flag to indicate not to run clover for this execution. If set to true, Clover will not be run. Default value is: false.
snapshot File - The location to store the clover snapshot file. This file needs to persist between builds to enable Clover's build optimization feature. If not specified, the snapshot will be stored next to the cloverDatabase.
waitForFlush boolean - If true we'll wait 2*flushInterval to ensure coverage data is flushed to the Clover database before running any query on it.

Note: The only use case where you would want to turn this off is if you're running your tests in a separate JVM. In that case the coverage data will be flushed by default upon the JVM shutdown and there would be no need to wait for the data to be flushed. As we can't control whether users want to fork their tests or not, we're offering this parameter to them.

Default value is: true.

Parameter Details

cloverDatabase:

The location of the Clover database.

  • Type: java.lang.String
  • Required: No
  • Expression: ${maven.clover.cloverDatabase}

cloverMergeDatabase:

The location of the merged clover database to create when running a report in a multimodule build.

  • Type: java.lang.String
  • Required: Yes
  • Expression: ${maven.clover.cloverMergeDatabase}
  • Default: ${project.build.directory}/clover/cloverMerge.db

cloverOutputDirectory:

The directory where the Clover plugin will put all the files it generates during the build process. For example the Clover plugin will put instrumented sources somewhere inside this directory.

  • Type: java.lang.String
  • Required: Yes
  • Default: ${project.build.directory}/clover

debug:

If you wish to enable debug level logging in just the Clover plugin, set this to true. This is useful for integrating Clover into the build

  • Type: boolean
  • Required: No
  • Expression: ${maven.clover.debug}
  • Default: false

flushInterval:

When the Clover Flush Policy is set to "interval" or threaded this value is the minimum period between flush operations (in milliseconds).

  • Type: int
  • Required: No
  • Expression: ${maven.clover.flushInterval}
  • Default: 500

flushPolicy:

The Clover flush policy to use. Valid values are directed, interval and threaded.

  • Type: java.lang.String
  • Required: No
  • Expression: ${maven.clover.flushPolicy}
  • Default: threaded

jdk:

Whether the Clover instrumentation should use the Clover jdk14, jdk15, jdk16 or jdk17 flags to parse sources. Valid values are 1.4, 1.5, 1.6 and 1.7 .

  • Type: java.lang.String
  • Required: No
  • Expression: ${maven.clover.jdk}

license:

The full Clover license String to use. If supplied, this certificate will be used over licenseLocation. NB. newline chars must be preserved. A trial Clover license can be generated here.

  • Type: java.lang.String
  • Required: No
  • Expression: ${maven.clover.license}

licenseLocation:

A Clover license file to be used by the plugin. The plugin tries to resolve this parameter first as a resource, then as a URL, and then as a file location on the filesystem. A trial Clover license can be generated here.

  • Type: java.lang.String
  • Required: No
  • Expression: ${maven.clover.licenseLocation}

project:

The Maven project instance for the executing project.

Note: This is passed by Maven and must not be configured by the user.

  • Type: org.apache.maven.project.MavenProject
  • Required: Yes
  • Expression: ${project}

singleCloverDatabase:

If true, then a single cloverDatabase will be used for the entire project. This flag will be ignored if a custom cloverDatabase location is specified.

  • Type: boolean
  • Required: No
  • Expression: ${maven.clover.singleCloverDatabase}
  • Default: false

skip:

A flag to indicate not to run clover for this execution. If set to true, Clover will not be run.

  • Type: boolean
  • Required: No
  • Expression: ${maven.clover.skip}
  • Default: false

snapshot:

The location to store the clover snapshot file. This file needs to persist between builds to enable Clover's build optimization feature. If not specified, the snapshot will be stored next to the cloverDatabase.

  • Type: java.io.File
  • Required: No
  • Expression: ${maven.clover.snapshot}

waitForFlush:

If true we'll wait 2*flushInterval to ensure coverage data is flushed to the Clover database before running any query on it.

Note: The only use case where you would want to turn this off is if you're running your tests in a separate JVM. In that case the coverage data will be flushed by default upon the JVM shutdown and there would be no need to wait for the data to be flushed. As we can't control whether users want to fork their tests or not, we're offering this parameter to them.

  • Type: boolean
  • Required: No
  • Expression: ${maven.clover.waitForFlush}
  • Default: true