package org.ehcache.build.conventions;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.tasks.testing.Test;
import org.gradle.testing.jacoco.plugins.JacocoPlugin;
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension;
import org.gradle.testing.jacoco.tasks.JacocoReport;

public class JacocoConvention implements Plugin<Project> {

  @Override
  public void apply(Project project) {
    project.getPlugins().apply(JacocoPlugin.class);

    project.getTasks().withType(JacocoReport.class).configureEach(jacocoReport -> {
      jacocoReport.getReports().configureEach(report -> {
        report.getRequired().set(false);
      });
    });

    project.getTasks().withType(Test.class).configureEach(test -> {
      test.getExtensions().configure(JacocoTaskExtension.class, jacoco -> {
        jacoco.getExcludes().add("org.terracotta.tripwire.*");
      });
    });
  }
}

@@ -183,32 +183,96 @@
 s.JacocoPlugin;%0A
+import org.gradle.testing.jacoco.plugins.JacocoPluginExtension;%0A
 import org.gradl
@@ -531,24 +531,150 @@
 in.class);%0A%0A
+    project.getExtensions().configure(JacocoPluginExtension.class, jacoco -%3E %7B%0A      jacoco.setToolVersion(%220.8.8%22);%0A    %7D);%0A%0A
     project.

Upgrade to Jacoco 0.8.8 for Java 18 compatibility.