# 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(objects: ObjectFactory, 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.

## Properties

address
Link copied to clipboard
@get:Nullable
@get:Optional
@get:Input
open var address: String
excludeClassLoaders
Link copied to clipboard
@get:Nullable
@get:Optional
@get:Input
open var excludeClassLoaders: List<String>
excludes
Link copied to clipboard
@get:Nullable
@get:Optional
@get:Input
open var excludes: List<String>
includes
Link copied to clipboard
@get:Nullable
@get:Optional
@get:Input
open var includes: List<String>
output
Link copied to clipboard
@get:Input
open var output: JacocoTaskExtension.Output
port
Link copied to clipboard
@get:Input
open var port: Int
sessionId
Link copied to clipboard
@get:Nullable
@get:Optional
@get:Input
open var sessionId: String

## Functions

getAgentClasspath
Link copied to clipboard
@Classpath
open fun getAgentClasspath(): FileCollection
The Jacoco agent classpath.
getAsJvmArg
Link copied to clipboard
@Internal
open fun getAsJvmArg(): 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
@Nullable
@Optional
@OutputFile
open fun getDestinationFile(): @Nullable File
The path for the execution data to be written to.
isDumpOnExit
Link copied to clipboard
@Input
open fun isDumpOnExit(): Boolean
Whether or not to dump the coverage data at VM shutdown.
isEnabled
Link copied to clipboard
@Input
open fun isEnabled(): Boolean
Whether or not the task should generate execution data.
isIncludeNoLocationClasses
Link copied to clipboard
@Input
open fun isIncludeNoLocationClasses(): Boolean
Whether or not classes without source location should be instrumented.
isJmx
Link copied to clipboard
@Input
open fun isJmx(): Boolean
Whether or not to expose functionality via JMX under `org.jacoco:type=Runtime`.
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)
open fun setDestinationFile(destinationFile: Provider<File>)
Set the provider for calculating the destination file.
setDumpOnExit
Link copied to clipboard
open fun setDumpOnExit(dumpOnExit: Boolean)
setEnabled
Link copied to clipboard
open fun setEnabled(enabled: Boolean)
setIncludeNoLocationClasses
Link copied to clipboard
open fun setIncludeNoLocationClasses(includeNoLocationClasses: Boolean)
setJmx
Link copied to clipboard
open fun setJmx(jmx: Boolean)