I'm trying to get JaCoCo code coverage reports to be generated whenever ./gradlew test
is run. I've got the following in my build.gradle
file:
apply plugin: "java" // needed by jacoco plugin
apply plugin: "jacoco"
test {
useJUnitPlatform()
}
jacoco {
toolVersion = "0.8.5"
applyTo junitPlatformTest
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
html.destination file("${buildDir}/jacoco/jacocoHtml")
}
}
junitPlatformTest {
jacoco {
destinationFile = file("${buildDir}/jacoco/jacocoReport.exec")
}
}
Whenever I run tests, no xml or html reports are generated. However, JaCoCo does generate a junitPlatformTest.exec
file in {buildDir}/jacoco
. How can I get it to generate some xml and html reports too?