clover:optimize

Full name:

com.atlassian.maven.plugins:clover-maven-plugin:4.1.2:optimize

Description:

Sets the 'test' property on the project which is used by the maven-surefire-plugin to determine which tests are run. If a snapshot file from a previous build, is found, that will be used to determine what tests should be run.

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: process-test-classes.

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.
User property is: maven.clover.cloverMergeDatabase.
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.


User property is: project.

Optional Parameters

Name Type Since Description
alwaysRunTests List - A list of Tests which should always be run. ie they will never be optimized away.
cloverDatabase String - The location of the Clover database.
User property is: maven.clover.cloverDatabase.
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.
User property is: maven.clover.debug.
enabled boolean - Toggles whether or not build optimization is to be done or not.
Default value is: true.
User property is: maven.clover.optimize.enabled.
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.
User property is: maven.clover.flushInterval.
fullRunEvery int -

The number of builds to run, before the snapshot file gets deleted.

The snapshot stores the mapping between your test cases and source code. Over time, this becomes stale, so it is recommended to regenerate this file, by running all tests, on a regular basis.


Default value is: 10.
User property is: maven.clover.fullRunEvery.
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.
User property is: maven.clover.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. A trial Clover license can be generated here.
User property is: maven.clover.licenseLocation.
minimize boolean - Controls whether or not to exclude tests that do not cover any modified files. If false, (and ordering is not random or original), Clover will not exclude any of the tests. Instead, they will be run in an optimal order to ensure the build fails as fast as possible. ie - tests that cover modify code first, then ascending by test time.
Default value is: true.
User property is: maven.clover.optimize.minimize.
optimizeExcludes List - A list of Tests to exclude from build optimization. If neither optimizeIncludes nor optimizeExcludes are supplied, then the excludes specified in the maven-surefire-plugin's configuration will be used.
optimizeIncludes List - A list of Tests to include for build optimization. If neither optimizeIncludes nor optimizeExcludes are supplied, then the includes specified in the maven-surefire-plugin's configuration will be used.
ordering String - NOTE: This currently has no effect, because the maven-surefire-plugin re-orders the tests alphabetically. This controls how Clover optimizes your tests. By default - clover excludes any test case it deems as irrelevant to any changes made to your source code. "failfast" - (default) ensures your build FAILs fast ie: tests relevant to code changes are run first "random" - tests will be shuffled before run. Can be used to determine inter-test-dependencies.
User property is: maven.clover.ordering.
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.
User property is: maven.clover.singleCloverDatabase.
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.
User property is: maven.clover.skip.
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.
User property is: maven.clover.snapshot.
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.
User property is: maven.clover.waitForFlush.

Parameter Details

alwaysRunTests:

A list of Tests which should always be run. ie they will never be optimized away.
  • Type: java.util.List
  • Required: No

cloverDatabase:

The location of the Clover database.
  • Type: java.lang.String
  • Required: No
  • User Property: 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
  • User Property: 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
  • User Property: maven.clover.debug
  • Default: false

enabled:

Toggles whether or not build optimization is to be done or not.
  • Type: boolean
  • Required: No
  • User Property: maven.clover.optimize.enabled
  • 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
  • User Property: maven.clover.flushInterval
  • Default: 500

fullRunEvery:

The number of builds to run, before the snapshot file gets deleted.

The snapshot stores the mapping between your test cases and source code. Over time, this becomes stale, so it is recommended to regenerate this file, by running all tests, on a regular basis.

  • Type: int
  • Required: No
  • User Property: maven.clover.fullRunEvery
  • Default: 10

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
  • User Property: 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
  • User Property: maven.clover.licenseLocation

minimize:

Controls whether or not to exclude tests that do not cover any modified files. If false, (and ordering is not random or original), Clover will not exclude any of the tests. Instead, they will be run in an optimal order to ensure the build fails as fast as possible. ie - tests that cover modify code first, then ascending by test time.
  • Type: boolean
  • Required: No
  • User Property: maven.clover.optimize.minimize
  • Default: true

optimizeExcludes:

A list of Tests to exclude from build optimization. If neither optimizeIncludes nor optimizeExcludes are supplied, then the excludes specified in the maven-surefire-plugin's configuration will be used.
  • Type: java.util.List
  • Required: No

optimizeIncludes:

A list of Tests to include for build optimization. If neither optimizeIncludes nor optimizeExcludes are supplied, then the includes specified in the maven-surefire-plugin's configuration will be used.
  • Type: java.util.List
  • Required: No

ordering:

NOTE: This currently has no effect, because the maven-surefire-plugin re-orders the tests alphabetically. This controls how Clover optimizes your tests. By default - clover excludes any test case it deems as irrelevant to any changes made to your source code. "failfast" - (default) ensures your build FAILs fast ie: tests relevant to code changes are run first "random" - tests will be shuffled before run. Can be used to determine inter-test-dependencies.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.clover.ordering

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
  • User Property: 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
  • User Property: 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
  • User Property: 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
  • User Property: 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
  • User Property: maven.clover.waitForFlush
  • Default: true