apply plugin: "jacoco" jacoco { toolVersion = "0.8.12" } /* These need to run after evaluation since jacoco plugin alters the test task based on the included test lib dependencies defined in each subproject (junit or testNG) */ afterEvaluate { test { finalizedBy jacocoTestReport } jacocoTestReport { dependsOn test reports { xml { required = true /* Tools that aggregate and analyse coverage tools search for the coverage result files. Keeping them under one folder will minimize the time spent searching through the full source tree. */ outputLocation = rootProject.layout.buildDirectory.file("coverage-reports/jacoco-${project.name}.xml") } csv.required = false html.required = false } } }