# JacocoTaskExtension

abstract class JacocoTaskExtension(source)

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

## Constructors

JacocoTaskExtension
Link copied to clipboard
@Inject
constructor(agent: JacocoAgentJar, task: JavaForkOptions)
Creates a Jacoco task extension.

## Types

Output
Link copied to clipboard
enum Output
The types of output that the agent can use for execution data.

## Functions

getAddress
Link copied to clipboard
@Optional
@Input
abstract fun getAddress(): Property<String>
IP address or hostname to use with TCP_SERVER or TCP_CLIENT.
getAgentClasspath
Link copied to clipboard
@Classpath
open fun getAgentClasspath(): FileCollection
The Jacoco agent classpath.
getAsJvmArg
Link copied to clipboard
@Internal
open fun getAsJvmArg(): Provider<String>
Gets all properties in the format expected of the agent JVM argument.
getClassDumpDir
Link copied to clipboard
@ReplacedBy(value = "classDumpDirectory")
@Nullable
open fun getClassDumpDir(): @Nullable File
Path to dump all class files the agent sees are dumped to.
getClassDumpDirectory
Link copied to clipboard
@Incubating
@Optional
@LocalState
abstract fun getClassDumpDirectory(): DirectoryProperty
Path to dump all class files the agent sees are dumped to.
getDestinationFile
Link copied to clipboard
@Internal
abstract fun getDestinationFile(): RegularFileProperty
The path for execution data to be written to.
getDumpOnExit
Link copied to clipboard
@Input
abstract fun getDumpOnExit(): Property<Boolean>
Whether or not to dump the coverage data at VM shutdown.
getEnabled
Link copied to clipboard
@Input
abstract fun getEnabled(): Property<Boolean>
Whether or not the task should generate execution data.
getExcludeClassLoaders
Link copied to clipboard
@Optional
@Input
abstract fun getExcludeClassLoaders(): ListProperty<String>
List of classloader names that should be excluded from analysis.
getExcludes
Link copied to clipboard
@Optional
@Input
abstract fun getExcludes(): ListProperty<String>
List of class names that should be excluded from analysis.
getIncludeNoLocationClasses
Link copied to clipboard
@Input
abstract fun getIncludeNoLocationClasses(): Property<Boolean>
Whether or not classes without source location should be instrumented.
getIncludes
Link copied to clipboard
@Optional
@Input
abstract fun getIncludes(): ListProperty<String>
List of class names that should be included in analysis.
getIsDumpOnExit
Link copied to clipboard
@Internal
open fun getIsDumpOnExit(): Property<Boolean>
getIsEnabled
Link copied to clipboard
@Internal
open fun getIsEnabled(): Property<Boolean>
getIsIncludeNoLocationClasses
Link copied to clipboard
@Internal
open fun getIsIncludeNoLocationClasses(): Property<Boolean>
getIsJmx
Link copied to clipboard
@Internal
open fun getIsJmx(): Property<Boolean>
getJmx
Link copied to clipboard
@Input
abstract fun getJmx(): Property<Boolean>
Whether or not to expose functionality via JMX under `org.jacoco:type=Runtime`.
getOutput
Link copied to clipboard
@Input
abstract fun getOutput(): Property<JacocoTaskExtension.Output>
The type of output to generate.
getPort
Link copied to clipboard
@Input
abstract fun getPort(): Property<Integer>
Port to bind to for TCP_SERVER or TCP_CLIENT.
getSessionId
Link copied to clipboard
@Optional
@Input
abstract fun getSessionId(): Property<String>
An identifier for the session written to the execution data.
setAddress
Link copied to clipboard
open fun setAddress(@Nullable address: @Nullable String)
setClassDumpDir
Link copied to clipboard
open fun setClassDumpDir(@Nullable classDumpDir: @Nullable File)
Sets path to dump all class files the agent sees are dumped to.
setDestinationFile
Link copied to clipboard
open fun setDestinationFile(@Nullable destinationFile: @Nullable File)
setDumpOnExit
Link copied to clipboard
open fun setDumpOnExit(dumpOnExit: Boolean)
setEnabled
Link copied to clipboard
open fun setEnabled(enabled: Boolean)
setExcludeClassLoaders
Link copied to clipboard
open fun setExcludeClassLoaders(@Nullable excludeClassLoaders: @Nullable List<String>)
setExcludes
Link copied to clipboard
open fun setExcludes(@Nullable excludes: @Nullable List<String>)
setIncludeNoLocationClasses
Link copied to clipboard
open fun setIncludeNoLocationClasses(includeNoLocationClasses: Boolean)
setIncludes
Link copied to clipboard
open fun setIncludes(@Nullable includes: @Nullable List<String>)
setJmx
Link copied to clipboard
open fun setJmx(jmx: Boolean)
setOutput
Link copied to clipboard
open fun setOutput(output: JacocoTaskExtension.Output)
setPort
Link copied to clipboard
open fun setPort(port: Int)
setSessionId
Link copied to clipboard
open fun setSessionId(@Nullable sessionId: @Nullable String)