Class PjacocoPlugin

java.lang.Object
io.pjacoco.gradle.PjacocoPlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class PjacocoPlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
Gradle plugin io.github.beltian.pjacoco. Resolves the pjacoco agent and wires -javaagent for per-test coverage (convention + escape hatch — see the design spec §5.5):
  • creates the pjacoco extension (PjacocoGradleExtension);
  • creates a resolvable pjacocoAgent configuration and depends on io.github.beltian.pjacoco:pjacoco-agent:<agentVersion> (the shaded jar);
  • populates pjacoco.agentJvmArg / pjacoco.controlUrlArg for manual wiring;
  • for each task named in attachTo, lazily injects the agent AND -Dpjacoco.control-url into that JVM (so the testkit activates).
  • Field Details

    • DEFAULT_AGENT_VERSION

      public static final String DEFAULT_AGENT_VERSION
      Default agent version when agentVersion is not set. Single-sourced from the plugin's OWN version (generated resource io/pjacoco/gradle/version.properties), so the agent it resolves always matches the plugin release — no hardcoded constant to forget on a version bump (P1-1).
  • Constructor Details

    • PjacocoPlugin

      public PjacocoPlugin()
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>