Package org.jacoco.maven
Class AbstractAgentMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.jacoco.maven.AbstractJacocoMojo
-
- org.jacoco.maven.AbstractAgentMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AgentITMojo,AgentMojo
public abstract class AbstractAgentMojo extends AbstractJacocoMojo
Base class for preparing a property pointing to the JaCoCo runtime agent that can be passed as a VM argument to the application under test.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.StringaddressIP address or hostname to bind to when the output method is tcpserver or connect to when the output method is tcpclient.(package private) static java.lang.StringAGENT_ARTIFACT_NAMEName of the JaCoCo Agent artifact.(package private) java.lang.BooleanappendIf set to true and the execution data file already exists, coverage data is appended to the existing file.(package private) java.io.FileclassDumpDirIf a directory is specified for this parameter the JaCoCo agent dumps all class files it processes to the given location.(package private) java.lang.BooleandumpOnExitIf set to true coverage data will be written on VM shutdown.(package private) java.lang.StringexclClassLoadersA list of class loader names, that should be excluded from execution analysis.private java.util.List<java.lang.String>excludesA list of class names to exclude from instrumentation.(package private) java.lang.BooleaninclBootstrapClassesSpecifies whether also classes from the bootstrap classloader should be instrumented.(package private) java.lang.BooleaninclNoLocationClassesSpecifies whether classes without source location should be instrumented.private java.util.List<java.lang.String>includesA list of class names to include in instrumentation.(package private) java.lang.BooleanjmxIf set to true the agent exposes functionality via JMX.(package private) java.lang.StringoutputOutput method to use for writing coverage data.(package private) java.util.Map<java.lang.String,org.apache.maven.artifact.Artifact>pluginArtifactMapMap of plugin artifacts.(package private) java.lang.IntegerportPort to bind to when the output method is tcpserver or connect to when the output method is tcpclient.(package private) java.lang.StringpropertyNameAllows to specify property which will contains settings for JaCoCo Agent.(package private) java.lang.StringsessionIdA session identifier that is written with the execution data.(package private) static java.lang.StringSUREFIRE_ARG_LINEName of the property used in maven-surefire-plugin.(package private) static java.lang.StringTYCHO_ARG_LINEName of the property used in maven-osgi-test-plugin.
-
Constructor Summary
Constructors Constructor Description AbstractAgentMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) AgentOptionscreateAgentOptions()voidexecuteMojo()Executes Mojo.(package private) java.io.FilegetAgentJarFile()(package private) abstract java.io.FilegetDestFile()(package private) java.lang.StringgetEffectivePropertyName()(package private) booleanisEclipseTestPluginPackaging()(package private) booleanisPropertyNameSpecified()protected voidskipMojo()Skips Mojo.-
Methods inherited from class org.jacoco.maven.AbstractJacocoMojo
execute, getProject
-
-
-
-
Field Detail
-
AGENT_ARTIFACT_NAME
static final java.lang.String AGENT_ARTIFACT_NAME
Name of the JaCoCo Agent artifact.- See Also:
- Constant Field Values
-
TYCHO_ARG_LINE
static final java.lang.String TYCHO_ARG_LINE
Name of the property used in maven-osgi-test-plugin.- See Also:
- Constant Field Values
-
SUREFIRE_ARG_LINE
static final java.lang.String SUREFIRE_ARG_LINE
Name of the property used in maven-surefire-plugin.- See Also:
- Constant Field Values
-
pluginArtifactMap
@Parameter(property="plugin.artifactMap", required=true, readonly=true) java.util.Map<java.lang.String,org.apache.maven.artifact.Artifact> pluginArtifactMapMap of plugin artifacts.
-
propertyName
@Parameter(property="jacoco.propertyName") java.lang.String propertyName
Allows to specify property which will contains settings for JaCoCo Agent. If not specified, then "argLine" would be used for "jar" packaging and "tycho.testArgLine" for "eclipse-test-plugin".
-
append
@Parameter(property="jacoco.append") java.lang.Boolean append
If set to true and the execution data file already exists, coverage data is appended to the existing file. If set to false, an existing execution data file will be replaced.
-
includes
@Parameter private java.util.List<java.lang.String> includes
A list of class names to include in instrumentation. May use wildcard characters (* and ?). When not specified everything will be included.
-
excludes
@Parameter private java.util.List<java.lang.String> excludes
A list of class names to exclude from instrumentation. May use wildcard characters (* and ?). When not specified nothing will be excluded. Except for performance optimization or technical corner cases this option is normally not required. If you want to exclude classes from the report please configure thereportgoal accordingly.
-
exclClassLoaders
@Parameter(property="jacoco.exclClassLoaders") java.lang.String exclClassLoaders
A list of class loader names, that should be excluded from execution analysis. The list entries are separated by a colon (:) and may use wildcard characters (* and ?). This option might be required in case of special frameworks that conflict with JaCoCo code instrumentation, in particular class loaders that do not have access to the Java runtime classes.
-
inclBootstrapClasses
@Parameter(property="jacoco.inclBootstrapClasses") java.lang.Boolean inclBootstrapClasses
Specifies whether also classes from the bootstrap classloader should be instrumented. Use this feature with caution, it needs heavy includes/excludes tuning.
-
inclNoLocationClasses
@Parameter(property="jacoco.inclNoLocationClasses") java.lang.Boolean inclNoLocationClasses
Specifies whether classes without source location should be instrumented.
-
sessionId
@Parameter(property="jacoco.sessionId") java.lang.String sessionId
A session identifier that is written with the execution data. Without this parameter a random identifier is created by the agent.
-
dumpOnExit
@Parameter(property="jacoco.dumpOnExit") java.lang.Boolean dumpOnExit
If set to true coverage data will be written on VM shutdown.
-
output
@Parameter(property="jacoco.output") java.lang.String output
Output method to use for writing coverage data. Valid options are:- file: At VM termination execution data is written to a file.
- tcpserver: The agent listens for incoming connections on the TCP port
specified by the
addressandport. Execution data is written to this TCP connection. - tcpclient: At startup the agent connects to the TCP port specified by
the
addressandport. Execution data is written to this TCP connection. - none: Do not produce any output.
-
address
@Parameter(property="jacoco.address") java.lang.String address
IP address or hostname to bind to when the output method is tcpserver or connect to when the output method is tcpclient. In tcpserver mode the value "*" causes the agent to accept connections on any local address.
-
port
@Parameter(property="jacoco.port") java.lang.Integer port
Port to bind to when the output method is tcpserver or connect to when the output method is tcpclient. In tcpserver mode the port must be available, which means that if multiple JaCoCo agents should run on the same machine, different ports have to be specified.
-
classDumpDir
@Parameter(property="jacoco.classDumpDir") java.io.File classDumpDir
If a directory is specified for this parameter the JaCoCo agent dumps all class files it processes to the given location. This can be useful for debugging purposes or in case of dynamically created classes for example when scripting engines are used.
-
jmx
@Parameter(property="jacoco.jmx") java.lang.Boolean jmx
If set to true the agent exposes functionality via JMX.
-
-
Method Detail
-
executeMojo
public void executeMojo()
Description copied from class:AbstractJacocoMojoExecutes Mojo.- Specified by:
executeMojoin classAbstractJacocoMojo
-
skipMojo
protected void skipMojo()
Description copied from class:AbstractJacocoMojoSkips Mojo.- Overrides:
skipMojoin classAbstractJacocoMojo
-
getAgentJarFile
java.io.File getAgentJarFile()
-
createAgentOptions
AgentOptions createAgentOptions()
-
getEffectivePropertyName
java.lang.String getEffectivePropertyName()
-
isPropertyNameSpecified
boolean isPropertyNameSpecified()
-
isEclipseTestPluginPackaging
boolean isEclipseTestPluginPackaging()
-
getDestFile
abstract java.io.File getDestFile()
- Returns:
- the destFile
-
-