Package org.gradle.testing.jacoco.plugins

## Class JacocoPluginExtension

- java.lang.Object
- - org.gradle.testing.jacoco.plugins.JacocoPluginExtension

-     public class JacocoPluginExtension
      extends Object

  Extension including common properties and methods for Jacoco.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected Project` | `project` | Deprecated.
    `static String` | `TASK_EXTENSION_NAME` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JacocoPluginExtension​(Project project, org.gradle.internal.jacoco.JacocoAgentJar agent)` | Creates a Jacoco plugin extension.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `<T extends Task & JavaForkOptions> void` | `applyTo​(TaskCollection<T> tasks)` | Applies Jacoco to all of the given tasks.
    `<T extends Task & JavaForkOptions> void` | `applyTo​(T task)` | Applies Jacoco to the given task.
    `File` | `getReportsDir()` | Deprecated.
    `DirectoryProperty` | `getReportsDirectory()` | The directory where reports will be generated.
    `String` | `getToolVersion()` | Version of Jacoco JARs to use.
    `void` | `setReportsDir​(File reportsDir)` | Deprecated. See `getReportsDirectory()`
    `void` | `setReportsDir​(Provider<File> reportsDir)` | Deprecated. See `getReportsDirectory()`
    `void` | `setToolVersion​(String toolVersion)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TASK_EXTENSION_NAME

          public static final String TASK_EXTENSION_NAME

      See Also:
        Constant Field Values

    - #### project

          @Deprecated
          protected final Project project

      Deprecated.

  - ### Constructor Detail

    - #### JacocoPluginExtension

          public JacocoPluginExtension​(Project project,
                                       org.gradle.internal.jacoco.JacocoAgentJar agent)

      Creates a Jacoco plugin extension.
      Parameters:
        `project` - the project the extension is attached to
        `agent` - the agent JAR to be used by Jacoco

  - ### Method Detail

    - #### getToolVersion

          public String getToolVersion()

      Version of Jacoco JARs to use.

    - #### setToolVersion

          public void setToolVersion​(String toolVersion)

    - #### getReportsDirectory

          public DirectoryProperty getReportsDirectory()

      The directory where reports will be generated.
      Since:
        6.8

    - #### getReportsDir

          @Deprecated
          public File getReportsDir()

      Deprecated.
      The directory where reports will be generated.

    - #### setReportsDir

          @Deprecated
          public void setReportsDir​(Provider<File> reportsDir)

      Deprecated.
      See `getReportsDirectory()`
      Set the provider for calculating the report directory.
      Parameters:
        `reportsDir` - Reports directory provider
      Since:
        4.0

    - #### setReportsDir

          @Deprecated
          public void setReportsDir​(File reportsDir)

      Deprecated.
      See `getReportsDirectory()`
      Set the provider for calculating the report directory.
      Parameters:
        `reportsDir` - Reports directory

    - #### applyTo

          public <T extends Task & JavaForkOptions> void applyTo​(T task)

      Applies Jacoco to the given task. Configuration options will be provided on a task extension named 'jacoco'. Jacoco will be run as an agent during the execution of the task.
      Parameters:
        `task` - the task to apply Jacoco to.
      See Also:
        `TASK_EXTENSION_NAME`

    - #### applyTo

          public <T extends Task & JavaForkOptions> void applyTo​(TaskCollection<T> tasks)

      Applies Jacoco to all of the given tasks.
      Parameters:
        `tasks` - the tasks to apply Jacoco to