Code coverage does not display - jacoco + gradle
Coverage view is not displayed - does not display coverage after running tests ("with Coverage" configuration).
IntelliJ IDEA 2024.3.5 (Ultimate Edition), Java coverage plugin enabled, on macOS.
Gradle 8.7, jacoco 0.8.13 (tried 0.8.8), Java 17.x
Coverage runner is set to JaCoCo:

Gradle configuration:
jacocoTestReport { reports { xml.required = true csv.required = true html.required = true } dependsOn test // tests are required to run before generating the report}jacoco { toolVersion = "0.8.8"}test { jacoco { // destinationFile = project.layout.buildDirectory.file("jacoco/jacocoTest.exec").get().asFile } finalizedBy jacocoTestReport // report is always generated after tests run}
This configuration does generate build/jacoco/test.exec and build/reports/jacoco/test/jacocoTestReport.* every time the tests (via IDE) are executed, however Coverage window is never activated.
I can manually load the exec file successfully - and coverage suite is displayed and is correct.
Also tried with output jacocoTest.exec (Maven plugin naming).
Tried enabling/disabling “Collect coverage in test folders” (on Settings).
No errors (or any) log messages that are coverage related.
Any debugging tips that anyone has?
- what is IDEA looking for? (*.exec? *.xml? which directory - root or subproject build?)
- is there a compatible version of gradle? or jacoco?
- is there any debugging that can be enabled to find out what the Coverage plugin is doing?
Please sign in to leave a comment.
Hello, there is no need to config jacoco in the build.gradle, I've tried the below project under IDEA 2024.3.6 Ultimate and it works well with jacoco engine. Can you upload a simple sample project to https://uploads.jetbrains.com/ and paste the upload id here, the uploaded file is only visible to JetBrains employees.
All my simple project examples work.
Just this project with 20+ sub-projects which themselves are part of a complex Gradle composite build layout. Coverage doesn't work in the sub-projects.
I can't share the source and building something similar as a reproducer would be a large effort, so I'm looking for any way that I can debug.
Hi David,
Can I know which kind of runner you are using? I've tried the composite build layout as shown in https://github.com/gradle/gradle/tree/master/platforms/documentation/docs/src/samples/build-organization/composite-builds/basic/kotlin , with Application runner, however the result isn't complete as some library class doesn't have coverage data. Can you provide more info about your project structure, which kind of runner you are using?