jacocoTestReport is skipping

I am using my own repo (not maven central). I zipped up the jacocoagent.jar and jacocoant.jar and dropped the zip files into my repo (see reference under dependencies). I do see 4 xxx.exec files under projectbuilddir/jacoco. but i also see that each time i run the task it is skipped in the log. It would also be nice I would get the condition that the onlyIf is failing on in the log.

2:05:27.305 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :storm:jacocoTestReport (Thread[Daemon Thread 13,5,main]) started. 12:05:27.305 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :storm:jacocoTestReport 12:05:27.306 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ‘:storm:jacocoTestReport’ 12:05:27.307 [INFO] [org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter] Skipping task ‘:storm:jacocoTestReport’ as task onlyIf is false. 12:05:27.308 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:storm:jacocoTestReport’ 12:05:27.309 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :storm:jacocoTestReport SKIPPED 12:05:27.309 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :storm:jacocoTestReport (Thread[Daemon Thread 13,5,main]) completed. Took 0.004 secs.

apply plugin: 'jacoco'
jacoco {
  toolVersion = ""
  reportsDir = file("$buildDir/customJacocoReportDir")
dependencies {
  testCompile libs.junit
  jacocoAgent files(repos.thirdParty + 'jacoco/v0.6.4/jacocoagent.jar.zip')
  jacocoAnt files(repos.thirdParty + 'jacoco/v0.6.4/jacocoant.jar.zip')
jacocoTestReport {
  group = "Reporting"
  description = "Generate Jacoco coverage reports after running tests."
  additionalSourceDirs = files("java")
  reports {
    xml.enabled false
    csv.enabled false
    html.destination "${buildDir}/jacocoHtml"

Also, I find it funny that jacocoAgent and jacocoAnt are expecting a ZIP file of the corresponding jar and cannot process the jar directly. This causes the jar to be dropped into the directory and then i must .git_ignore it

It is not required to ZIP the JaCoCo JAR files. What makes you think that this is needed? Here’s an example build script that generates the metrics and report with local dependencies:

apply plugin: 'java'
apply plugin: 'jacoco'
  dependencies {
    testCompile files("$projectDir/libs/junit-4.8.2.jar")
    jacocoAgent files("$projectDir/libs/org.jacoco.agent-")
    jacocoAnt files("$projectDir/libs/org.jacoco.ant-",

Keep in mind that the task “jacocoTestReport” does not depend on the “test” task which also generates the exec files. If “jacocoTestReport” can’t find exec files, it will be marked SKIPPED.

well, yesterday when i pointed to the jar directly it was saying expecting ZIP with one file and not found. sorry, but lost the logs as restarted terminal. today, works fine as in your example above.

however, i only get .exec files generated with gradle test and none with gradle jacocotestreport

my thinking, which is probably off, is that jacoco cannot figure out the special naming we had set up when you were here.

ls build/storm/jacoco

also, it would be really nice to not build the exec files during test, but only upon demand with jacocotestreport task

they are quite slow compared to just the pure junit testing

JaCoCo adds an agent to the JVM when executing your tests to generate the code coverage metrics. Trying to add it to the reporting task would be too late. For disabling the generation of code coverage you can set the property “enabled” to false. Have a look at the exposed properties on the plugin page.

The task jacocoTestReport only works for the test task. If your project defines other test task (which is the case in your project), you will need to set up a new JaCoCo test report task. For example:

task jacocoIntegrationTestReport(type: JacocoReport) {
   sourceSets sourceSets.main
   executionData integrationTest

This example would have to be modified based on the name of your source set and the name of your test task.

Thanks Ben. Is there any way to combine the reports?

brought in Ben for some consulting and we finally got this working after a few hours