Class PjacocoGradleExtension

java.lang.Object
io.pjacoco.gradle.PjacocoGradleExtension

public abstract class PjacocoGradleExtension extends Object
DSL for the io.github.beltian.pjacoco plugin:

 pjacoco {
     agentVersion.set("1.3.0")                    // default: the plugin's own version (DEFAULT_AGENT_VERSION)
     port.set(6310)
     includes.set(listOf("com.example.*"))
     excludes.set(emptyList())
     destfile.set(layout.buildDirectory.dir("pjacoco"))
     attachTo.set(listOf("integrationTest"))      // task names to auto-inject the agent into
 }
 
The plugin also populates the read-only providers getAgentJvmArg() and getControlUrlArg() for wiring the agent onto a separately-launched server.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.gradle.api.provider.Property<String>
    Read-only (plugin-populated): the composed -javaagent:... argument.
    abstract org.gradle.api.provider.Property<String>
    Version of io.github.beltian.pjacoco:pjacoco-agent to resolve.
    abstract org.gradle.api.provider.Property<Boolean>
    Write the whole-run aggregate .exec at shutdown.
    abstract org.gradle.api.provider.Property<String>
    Aggregate file name (or absolute path).
    abstract org.gradle.api.provider.ListProperty<String>
    Names of Test/JavaExec tasks to auto-inject the agent (and control-url) into.
    abstract org.gradle.api.provider.Property<Boolean>
    Inject junit.jupiter.extensions.autodetection.enabled=true so the in-process JUnit 5 extension auto-applies suite-wide (no @ExtendWith).
    abstract org.gradle.api.provider.Property<String>
    Read-only (plugin-populated): the -Dpjacoco.control-url=... argument the testkit needs.
    abstract org.gradle.api.file.DirectoryProperty
    Output directory for per-test .exec files.
    abstract org.gradle.api.provider.ListProperty<String>
    jacoco-style exclude patterns.
    abstract org.gradle.api.provider.ListProperty<String>
    jacoco-style include patterns (WildcardMatcher).
    abstract org.gradle.api.provider.Property<Boolean>
    Weave JUnit 4's runLeaf for zero-touch per-test activation.
    abstract org.gradle.api.provider.Property<Integer>
    Control-endpoint port (also where the agent binds).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PjacocoGradleExtension

      public PjacocoGradleExtension()
  • Method Details

    • getAgentVersion

      public abstract org.gradle.api.provider.Property<String> getAgentVersion()
      Version of io.github.beltian.pjacoco:pjacoco-agent to resolve.
    • getPort

      public abstract org.gradle.api.provider.Property<Integer> getPort()
      Control-endpoint port (also where the agent binds). Default 6310.
    • getIncludes

      public abstract org.gradle.api.provider.ListProperty<String> getIncludes()
      jacoco-style include patterns (WildcardMatcher). Empty → agent default *.
    • getExcludes

      public abstract org.gradle.api.provider.ListProperty<String> getExcludes()
      jacoco-style exclude patterns.
    • getDestfile

      public abstract org.gradle.api.file.DirectoryProperty getDestfile()
      Output directory for per-test .exec files. Default build/pjacoco.
    • getAttachTo

      public abstract org.gradle.api.provider.ListProperty<String> getAttachTo()
      Names of Test/JavaExec tasks to auto-inject the agent (and control-url) into.
    • getAutoDetectExtensions

      public abstract org.gradle.api.provider.Property<Boolean> getAutoDetectExtensions()
      Inject junit.jupiter.extensions.autodetection.enabled=true so the in-process JUnit 5 extension auto-applies suite-wide (no @ExtendWith). Default true; set false to opt out.
    • getAggregate

      public abstract org.gradle.api.provider.Property<Boolean> getAggregate()
      Write the whole-run aggregate .exec at shutdown. Default true.
    • getAggregateFile

      public abstract org.gradle.api.provider.Property<String> getAggregateFile()
      Aggregate file name (or absolute path). Unset → agent default aggregate.exec.
    • getJunit4Auto

      public abstract org.gradle.api.provider.Property<Boolean> getJunit4Auto()
      Weave JUnit 4's runLeaf for zero-touch per-test activation. Default true.
    • getAgentJvmArg

      public abstract org.gradle.api.provider.Property<String> getAgentJvmArg()
      Read-only (plugin-populated): the composed -javaagent:... argument.
    • getControlUrlArg

      public abstract org.gradle.api.provider.Property<String> getControlUrlArg()
      Read-only (plugin-populated): the -Dpjacoco.control-url=... argument the testkit needs.