JacocoTaskExtension (Gradle API 2.14.1)

Package: org.gradle.testing.jacoco.plugins

## [Java] Class JacocoTaskExtension

- org.gradle.testing.jacoco.plugins.JacocoTaskExtension

- Extension for tasks that should run with a Jacoco agent to generate coverage execution data.

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `enum` | `JacocoTaskExtension.Output` | The types of output that the agent can use for execution data.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `JacocoTaskExtension (org.gradle.internal.jacoco.JacocoAgentJar agent, JavaForkOptions task)` Creates a Jacoco task extension.

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `String` | `getAddress()` IP address or hostname to use with Output#TCP_SERVER#TCP_SERVER or Output#TCP_CLIENT#TCP_CLIENT.
    `org.gradle.internal.jacoco.JacocoAgentJar` | `getAgent()` agent
    `boolean` | `getAppend()` Whether or not data should be appended if the `destinationFile` already exists.
    `String` | `getAsJvmArg()` Gets all properties in the format expected of the agent JVM argument.
    `File` | `getClassDumpFile()` Path to dump all class files the agent sees are dumped to.
    `File` | `getDestinationFile()` The path for the execution data to be written to.
    `boolean` | `getDumpOnExit()` Whether or not to dump the coverage data at VM shutdown.
    `boolean` | `getEnabled()` Whether or not the task should generate execution data.
    `List<String>` | `getExcludeClassLoaders()` List of classloader names that should be excluded from analysis.
    `List<String>` | `getExcludes()` List of class names that should be excluded from analysis.
    `boolean` | `getIncludeNoLocationClasses()` Whether or not classes without source location should be instrumented.
    `List<String>` | `getIncludes()` List of class names that should be included in analysis.
    `boolean` | `getJmx()` Whether or not to expose functionality via JMX under `org.jacoco:type=Runtime`.
    `JacocoTaskExtension.Output` | `getOutput()` The type of output to generate.
    `int` | `getPort()` Port to bind to for Output#TCP_SERVER#TCP_SERVER or Output#TCP_CLIENT#TCP_CLIENT.
    `String` | `getSessionId()` An identifier for the session written to the execution data.
    `boolean` | `isAppend()`
    `boolean` | `isDumpOnExit()`
    `boolean` | `isEnabled()`
    `boolean` | `isIncludeNoLocationClasses()`
    `boolean` | `isJmx()`
    `void` | `setAddress(String address)`
    `void` | `setAgent(org.gradle.internal.jacoco.JacocoAgentJar agent)` agent
    `void` | `setAppend(boolean append)`
    `void` | `setClassDumpFile(File classDumpFile)`
    `void` | `setDestinationFile(File destinationFile)`
    `void` | `setDumpOnExit(boolean dumpOnExit)`
    `void` | `setEnabled(boolean enabled)`
    `void` | `setExcludeClassLoaders(List<String> excludeClassLoaders)`
    `void` | `setExcludes(List<String> excludes)`
    `void` | `setIncludeNoLocationClasses(boolean includeNoLocationClasses)`
    `void` | `setIncludes(List<String> includes)`
    `void` | `setJmx(boolean jmx)`
    `void` | `setOutput(JacocoTaskExtension.Output output)`
    `void` | `setPort(int port)`
    `void` | `setSessionId(String sessionId)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class groovy.lang.GroovyObjectSupport` | `groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll()`
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### public JacocoTaskExtension(org.gradle.internal.jacoco.JacocoAgentJar agent, JavaForkOptions task)

      Creates a Jacoco task extension.

      Parameters:
        `agent` - the agent JAR to use for analysis
        `task` - the task we extend

  - ### Method Detail

    - #### public String getAddress()

      IP address or hostname to use with Output#TCP_SERVER#TCP_SERVER or Output#TCP_CLIENT#TCP_CLIENT. Defaults to localhost.

    - #### @Deprecated public org.gradle.internal.jacoco.JacocoAgentJar getAgent()

      agent

      deprecated:
        Agent should be considered final.

    - #### public boolean getAppend()

      Whether or not data should be appended if the `destinationFile` already exists. Defaults to `true`.

    - #### public String getAsJvmArg()

      Gets all properties in the format expected of the agent JVM argument.

      Returns:
        state of extension in a JVM argument

    - #### public File getClassDumpFile()

      Path to dump all class files the agent sees are dumped to. Defaults to no dumps.

    - #### public File getDestinationFile()

      The path for the execution data to be written to.

    - #### public boolean getDumpOnExit()

      Whether or not to dump the coverage data at VM shutdown. Defaults to `true`.

    - #### public boolean getEnabled()

      Whether or not the task should generate execution data. Defaults to `true`.

    - #### public List<String> getExcludeClassLoaders()

      List of classloader names that should be excluded from analysis. Names can use wildcards (* and ?). Defaults to an empty list.

    - #### public List<String> getExcludes()

      List of class names that should be excluded from analysis. Names can use wildcard (* and ?). Defaults to an empty list.

    - #### public boolean getIncludeNoLocationClasses()

      Whether or not classes without source location should be instrumented. Defaults to `false`. This property is only taken into account if the used JaCoCo version supports this option (JaCoCo version >= 0.7.6)

    - #### public List<String> getIncludes()

      List of class names that should be included in analysis. Names can use wildcards (* and ?). If left empty, all classes will be included. Defaults to an empty list.

    - #### public boolean getJmx()

      Whether or not to expose functionality via JMX under `org.jacoco:type=Runtime`. Defaults to `false`. The configuration of the jmx property is only taken into account if the used JaCoCo version supports this option (JaCoCo version >= 0.6.2)

    - #### public JacocoTaskExtension.Output getOutput()

      The type of output to generate. Defaults to Output#FILE#FILE.

    - #### public int getPort()

      Port to bind to for Output#TCP_SERVER#TCP_SERVER or Output#TCP_CLIENT#TCP_CLIENT. Defaults to 6300.

    - #### public String getSessionId()

      An identifier for the session written to the execution data. Defaults to an auto-generated identifier.

    - #### public boolean isAppend()

    - #### public boolean isDumpOnExit()

    - #### public boolean isEnabled()

    - #### public boolean isIncludeNoLocationClasses()

    - #### public boolean isJmx()

    - #### public void setAddress(String address)

    - #### @Deprecated public void setAgent(org.gradle.internal.jacoco.JacocoAgentJar agent)

      agent

      deprecated:
        Agent should be considered final.

    - #### public void setAppend(boolean append)

    - #### public void setClassDumpFile(File classDumpFile)

    - #### public void setDestinationFile(File destinationFile)

    - #### public void setDumpOnExit(boolean dumpOnExit)

    - #### public void setEnabled(boolean enabled)

    - #### public void setExcludeClassLoaders(List<String> excludeClassLoaders)

    - #### public void setExcludes(List<String> excludes)

    - #### public void setIncludeNoLocationClasses(boolean includeNoLocationClasses)

    - #### public void setIncludes(List<String> includes)

    - #### public void setJmx(boolean jmx)

    - #### public void setOutput(JacocoTaskExtension.Output output)

    - #### public void setPort(int port)

    - #### public void setSessionId(String sessionId)