Package: org.gradle.testing.jacoco.plugins

## [Groovy] 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.

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `String` | `address` IP address or hostname to use with Output#TCP_SERVER#TCP_SERVER or Output#TCP_CLIENT#TCP_CLIENT.
    `org.gradle.internal.jacoco.JacocoAgentJar` | `agent`
    `boolean` | `append` Whether or not data should be appended if the `destinationFile` already exists.
    `File` | `classDumpFile` Path to dump all class files the agent sees are dumped to.
    `File` | `destinationFile` The path for the execution data to be written to.
    `boolean` | `dumpOnExit` Whether or not to dump the coverage data at VM shutdown.
    `boolean` | `enabled` Whether or not the task should generate execution data.
    `List<String>` | `excludeClassLoaders` List of classloader names that should be excluded from analysis.
    `List<String>` | `excludes` List of class names that should be excluded from analysis.
    `boolean` | `includeNoLocationClasses` Whether or not classes without source location should be instrumented.
    `List<String>` | `includes` List of class names that should be included in analysis.
    `boolean` | `jmx` Whether or not to expose functionality via JMX under `org.jacoco:type=Runtime`.
    `JacocoTaskExtension.Output` | `output` The type of output to generate.
    `int` | `port` Port to bind to for Output#TCP_SERVER#TCP_SERVER or Output#TCP_CLIENT#TCP_CLIENT.
    `String` | `sessionId` An identifier for the session written to the 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` | `getAsJvmArg()` Gets all properties in the format expected of the agent JVM argument.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Property Detail

    - #### String address

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

    - #### org.gradle.internal.jacoco.JacocoAgentJar agent

    - #### boolean append

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

    - #### File classDumpFile

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

    - #### File destinationFile

      The path for the execution data to be written to.

    - #### boolean dumpOnExit

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

    - #### boolean enabled

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

    - #### List<String> excludeClassLoaders

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

    - #### List<String> excludes

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

    - #### boolean includeNoLocationClasses

      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)

    - #### List<String> includes

      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.

    - #### boolean jmx

      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)

    - #### JacocoTaskExtension.Output output

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

    - #### int port

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

    - #### String sessionId

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

  - ### Constructor Detail

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

      Creates a Jacoco task extension.

      Parameters:
        `project` - the project the task is attached to
        `agent` - the agent JAR to use for analysis

  - ### Method Detail

    - #### String getAsJvmArg()

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

      Returns:
        state of extension in a JVM argument