com.atlassian.maven.plugin.clover.internal
Class AbstractCloverInstrumentMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.atlassian.maven.plugin.clover.internal.AbstractCloverMojo
          extended by com.atlassian.maven.plugin.clover.internal.AbstractCloverInstrumentMojo
All Implemented Interfaces:
CloverConfiguration, CompilerConfiguration, org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
CloverInstrumentInternalMojo, CloverInstrumentMojo

public class AbstractCloverInstrumentMojo
extends AbstractCloverMojo
implements CompilerConfiguration

Common settings for clover2:instr / clover2:setup MOJOs.


Field Summary
protected  long cloveredArtifactExpiryInMillis
          The difference (in milliseconds) that a -clover classified artifact can have to a non-clover classified artifact.
protected  boolean copyExcludedFiles
          If set, then the maven-clover2-plugin will not copy files that were excluded, across to the target/clover directory.
protected  DistributedCoverage distributedCoverage
          The configuration for distributed coverage collection by Clover.
protected  String encoding
          The character encoding to use when parsing source files.
protected  Set<String> excludes
          The list of file to exclude from the instrumentation.
protected  String excludesList
          The comma seperated list of file to exclude from the instrumentation.
protected  String flushPolicy
          The Clover flush policy to use.
protected  File groverJar
          By default, Maven Clover Plugin generates the ${java.io.tmpdir}/grover*.jar file during setup, which is next being added as the dependent artifact to the build.
protected  Set<String> includes
          The list of file to include in the instrumentation.
protected  boolean includesAllSourceRoots
          Till 3.1.11: whether the Clover plugin should instrument all source roots (for example src/main/java, src/main/groovy, target/generated-sources, so including the generated sources) or whether it should only instrument the main source root (usually src/main/java).
protected  String includesList
          The comma seperated list of files to include in the instrumentation.
protected  boolean includesTestSourceRoots
          Whether the Clover plugin should instrument test source roots.
protected  String instrumentation
          The level to instrument to.
protected  String jdk
          Which Java language level Clover shall use to parse sources.
protected  Map<String,String> methodContexts
          Specifies the custom method contexts to use for filtering specific methods from Clover reports.
protected  String scope
          When creating the clover.jar dependency, what scope to use.
protected  boolean setTestFailureIgnore
          If set to true, Clover will add several properties to the build configuration which disable a build failure for following plugins: maven-surefire-plugin (maven.test.failure.ignore=true) maven-failsafe-plugin (maven.test.failure.ignore=true) maven-checkstyle-plugin (checkstyle.failOnViolation=false) maven-pmd-plugin (pmd.failOnViolation=false) Thanks to this, build continues despite test failures or code validation failures and thus it is possible to generate a Clover coverage report for failed tests at the end of the build.
protected  boolean skipGroverJar
          By default, Maven Clover Plugin generates the ${java.io.tmpdir}/grover*.jar file during setup, which is next being added as the dependent artifact to the build.
protected  int staleMillis
          Sets the granularity in milliseconds of the last modification date for testing whether a source needs reinstrumentation.
protected  Map<String,String> statementContexts
          Specifies the custom statement contexts to use for filtering specific statements from Clover reports.
protected  boolean useCloverClassifier
          Whether or not to include the -clover classifier on artifacts.
protected  boolean useFullyQualifiedJavaLang
          Use the fully qualified package name for java.lang.* classes.
 
Fields inherited from class com.atlassian.maven.plugin.clover.internal.AbstractCloverMojo
cloverOutputDirectory, debug, license, licenseLocation, skip, snapshot
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractCloverInstrumentMojo()
           
 
Method Summary
 DistributedCoverage getDistributedCoverage()
           
 String getEncoding()
           
 Set<String> getExcludes()
           
 String getFlushPolicy()
           
 Set<String> getIncludes()
           
 String getInstrumentation()
           
 String getInstrumentLambda()
           
 String getJdk()
           
 Map<String,String> getMethodContexts()
           
 int getStaleMillis()
           
 Map<String,String> getStatementContexts()
           
 boolean isCopyExcludedFiles()
           
 boolean isIncludesAllSourceRoots()
           
 boolean isUseFullyQualifiedJavaLang()
           
 
Methods inherited from class com.atlassian.maven.plugin.clover.internal.AbstractCloverMojo
areCloverDatabasesAvailable, execute, getCloverDatabase, getCloverMergeDatabase, getDescendentModuleProjects, getFlushInterval, getModuleProjects, getProject, getReactorProjects, getResourceAsFile, getResourceManager, getWaitForFlush, isLastProjectInReactor, isModuleOfProject, isSingleCloverDatabase, registerCloverAntTasks, registerLicenseFile, registerLicenseFile, resolveCloverDatabase, setLicense, setLicenseLocation, setProject, setResourceManager, waitForFlush
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.maven.plugin.clover.internal.CompilerConfiguration
getFlushInterval
 
Methods inherited from interface com.atlassian.maven.plugin.clover.internal.CloverConfiguration
getCloverDatabase, getLog, getProject, getReactorProjects, isSingleCloverDatabase, resolveCloverDatabase
 

Field Detail

cloveredArtifactExpiryInMillis

protected long cloveredArtifactExpiryInMillis
The difference (in milliseconds) that a -clover classified artifact can have to a non-clover classified artifact. If the -clover classified artifact is more than cloveredArtifactExpiryInMillis older than the non-clover classified artifact, then the non-classified artifact will be used. This setting defaults to 2000.


copyExcludedFiles

protected boolean copyExcludedFiles
If set, then the maven-clover2-plugin will not copy files that were excluded, across to the target/clover directory. This is useful if the build is also using plugins such as the maven-gwt-plugin, that scans for resources, and skips a step if none are found. Otherwise, setting this to false could well cause build failures.


distributedCoverage

protected DistributedCoverage distributedCoverage
The configuration for distributed coverage collection by Clover. If present, default values will be used and coverage will be collected across JVMs. Optional nested elements (and their defaults) of distributedCoverage are:


encoding

protected String encoding
The character encoding to use when parsing source files.


excludes

protected Set<String> excludes
The list of file to exclude from the instrumentation. Patterns are resolved against source roots.


excludesList

protected String excludesList
The comma seperated list of file to exclude from the instrumentation. Patterns are resolved against source roots.


flushPolicy

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


groverJar

protected File groverJar

By default, Maven Clover Plugin generates the ${java.io.tmpdir}/grover*.jar file during setup, which is next being added as the dependent artifact to the build. As the file has generated, unique name and the jar is not being removed at the end of the build, these files can litter the temporary directory.

By setting this parameter you can:

a) specify constant file name for generated artifact,

b) choose location different than ${java.io.tmpdir}.

However, you must ensure that:

a) grover.jar will not be deleted till end of the build (for example don't put into ./target directory and next run mvn clover2:setup clean)

b) grover.jar will not be shared among builds with different Maven Clover Plugin versions used (for example if ProjectA uses Clover v 3.1.8 and ProjectB uses Clover v 3.1.9 then they shall have different groverJar locations defined)

Since:
3.1.8

includes

protected Set<String> includes
The list of file to include in the instrumentation. Patterns are resolved against source roots. Defaults are '**/*.java, **/*.groovy' which are overwritten if <includes> is set by the user


includesList

protected String includesList
The comma seperated list of files to include in the instrumentation. Patterns are resolved against source roots. Defaults are **.java which are overwritten if <includes> is set by the user


includesAllSourceRoots

protected boolean includesAllSourceRoots

Till 3.1.11: whether the Clover plugin should instrument all source roots (for example src/main/java, src/main/groovy, target/generated-sources, so including the generated sources) or whether it should only instrument the main source root (usually src/main/java).

Since 3.1.12: whether the Clover plugin should instrument all source roots (for example src/main/java, src/main/groovy, target/generated-sources, so including the generated sources) or whether it should instrument non-generated source roots (i.e. all roots except target/generated-sources/*)


includesTestSourceRoots

protected boolean includesTestSourceRoots
Whether the Clover plugin should instrument test source roots.


instrumentation

protected String instrumentation
The level to instrument to. Valid values are 'method' or 'statement'. Default is 'statement'. Setting this to 'method' greatly reduces the overhead of enabling Clover, however limited or no reporting is available. The current use of setting this to method is for Test Optimization only.


jdk

protected String jdk
Which Java language level Clover shall use to parse sources. Valid values are: By default Clover instruments using the highest language level supported.


methodContexts

protected Map<String,String> methodContexts
Specifies the custom method contexts to use for filtering specific methods from Clover reports. e.g.
<main>public static void main\(String args\[\]\).*</main>
will define the context called 'main' which will match all public static void main methods.


scope

protected String scope
When creating the clover.jar dependency, what scope to use. This may be one of: compile, test, provided etc. If not specified - provided will be used.


setTestFailureIgnore

protected boolean setTestFailureIgnore

If set to true, Clover will add several properties to the build configuration which disable a build failure for following plugins:

Thanks to this, build continues despite test failures or code validation failures and thus it is possible to generate a Clover coverage report for failed tests at the end of the build.

Note: before version 3.1.9 the testFailureIgnore property was set to true for the forked Clover lifecycle ('instrument' goal) for 'test' and 'integration-test' phases. Since 3.1.9 it is no longer set.

Since:
3.1.9

skipGroverJar

protected boolean skipGroverJar

By default, Maven Clover Plugin generates the ${java.io.tmpdir}/grover*.jar file during setup, which is next being added as the dependent artifact to the build. As the file has generated, unique name and the jar is not being removed at the end of the build, these files can litter the temporary directory.

In case when there is no Groovy code in the project, this parameter can be set to true in order to disable generation of grover.jar artifact.

Since:
3.1.8

statementContexts

protected Map<String,String> statementContexts
Specifies the custom statement contexts to use for filtering specific statements from Clover reports. e.g.
<log>^LOG\..*</log>
defines a statement context called "log" which matches all LOG statements.


staleMillis

protected int staleMillis
Sets the granularity in milliseconds of the last modification date for testing whether a source needs reinstrumentation.


useCloverClassifier

protected boolean useCloverClassifier
Whether or not to include the -clover classifier on artifacts.


useFullyQualifiedJavaLang

protected boolean useFullyQualifiedJavaLang
Use the fully qualified package name for java.lang.* classes.

Constructor Detail

AbstractCloverInstrumentMojo

public AbstractCloverInstrumentMojo()
Method Detail

isCopyExcludedFiles

public boolean isCopyExcludedFiles()
Specified by:
isCopyExcludedFiles in interface CompilerConfiguration

getEncoding

public String getEncoding()
Specified by:
getEncoding in interface CompilerConfiguration

getDistributedCoverage

public DistributedCoverage getDistributedCoverage()
Specified by:
getDistributedCoverage in interface CompilerConfiguration

getExcludes

public Set<String> getExcludes()
Specified by:
getExcludes in interface CompilerConfiguration

getFlushPolicy

public String getFlushPolicy()
Specified by:
getFlushPolicy in interface CompilerConfiguration

getIncludes

public Set<String> getIncludes()
Specified by:
getIncludes in interface CompilerConfiguration

getInstrumentation

public String getInstrumentation()
Specified by:
getInstrumentation in interface CompilerConfiguration

getInstrumentLambda

public String getInstrumentLambda()
Specified by:
getInstrumentLambda in interface CompilerConfiguration

getJdk

public String getJdk()
Specified by:
getJdk in interface CompilerConfiguration

getMethodContexts

public Map<String,String> getMethodContexts()
Specified by:
getMethodContexts in interface CompilerConfiguration

getStatementContexts

public Map<String,String> getStatementContexts()
Specified by:
getStatementContexts in interface CompilerConfiguration

getStaleMillis

public int getStaleMillis()
Specified by:
getStaleMillis in interface CompilerConfiguration

isIncludesAllSourceRoots

public boolean isIncludesAllSourceRoots()
Specified by:
isIncludesAllSourceRoots in interface CompilerConfiguration

isUseFullyQualifiedJavaLang

public boolean isUseFullyQualifiedJavaLang()
Specified by:
isUseFullyQualifiedJavaLang in interface CompilerConfiguration


Copyright © 2015 Atlassian Pty Ltd. All Rights Reserved.