clover:check

Verify Test Percentage Coverage (TPC) from an existing Clover database and fail the build if it is below the defined threshold. The check is done on main Clover databases and also on merged Clover databases when they exist.

Mojo Attributes:

  • Requires a Maven 2.0 project to execute.
  • Automatically executes within the lifecycle phase: verify

Required Parameters

Name Type Description
cloverDatabase String The location of the Clover database.
cloverMergeDatabase String The location of the merged clover database to create when running a report in a multimodule build.
project MavenProject The Maven project instance for the executing project. Note: This is passed by Maven and must not be configured by the user.
targetPercentage String The Test Percentage Coverage (TPC) threshold under which the plugin will report an error and fail the build. Default value is 70%.

Optional Parameters

Name Type Description
contextFilters String Comma or space separated list of Clover contexts (block, statement or method filers) to exclude when generating coverage reports.
failOnViolation boolean Do we fail the build on a violation? The default is true but there are some edge cases where you want to be able to check what would fail but without actually failing the build. For example you may want to let the build continue so that you can verify others checks that are executed after the Clover checks. Default value is true.
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 or jdk15 flags to parse sources.
licenseFile String A Clover license file to be used by the plugin. If not specified, the Clover plugin uses a default evaluation license.
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.
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: Yes
  • Expression: ${project.build.directory}/clover/clover.db

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: ${project.build.directory}/clover/cloverMerge.db

contextFilters Comma or space separated list of Clover contexts (block, statement or method filers) to exclude when generating coverage reports.
  • Type: java.lang.String
  • Required: No

failOnViolation Do we fail the build on a violation? The default is true but there are some edge cases where you want to be able to check what would fail but without actually failing the build. For example you may want to let the build continue so that you can verify others checks that are executed after the Clover checks.
  • Type: boolean
  • Required: No
  • Expression: ${failOnViolation}
  • Default: true

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
  • Default: 500

flushPolicy The Clover flush policy to use. Valid values are directed, interval and threaded.
  • Type: java.lang.String
  • Required: No
  • Default: threaded

jdk Whether the Clover instrumentation should use the Clover jdk14 or jdk15 flags to parse sources.
  • Type: java.lang.String
  • Required: No

licenseFile A Clover license file to be used by the plugin. If not specified, the Clover plugin uses a default evaluation license.
  • Type: java.lang.String
  • Required: No

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.
  • Type: java.lang.String
  • Required: No

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}

targetPercentage The Test Percentage Coverage (TPC) threshold under which the plugin will report an error and fail the build.
  • Type: java.lang.String
  • Required: Yes
  • Default: 70%

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
  • Default: true