SupercovBlog

Guide

JaCoCo report not generated: the causes in Maven and Gradle

Eight ways to end up with no report, each reproduced with JaCoCo 0.8.16, Maven and Gradle, and the fix for each.

No exec file. No report. A brushed-aluminum tray of three pockets, the last one empty, its violet tile lying on the floor in front.

A JaCoCo report needs two steps: the agent records jacoco.exec while the tests run, then the report goal turns it into HTML and XML. If the log says “Skipping JaCoCo execution due to missing execution data file”, the first step failed. If there is a jacoco.exec but no target/site/jacoco, the second step never ran.

A diagram of how a report is made: the tests run with the agent and write jacoco.exec, then the report goal writes target/site/jacoco. No exec file when argLine drops the agent, prepare-agent is missing, forkCount is 0 or tests are skipped. An exec file but no report when there is no report execution, it is bound to verify while you run mvn test, or Gradle runs only test.
How a report is made, and which causes break each part.

Causes at a glance

BuildCausejacoco.execReport
MavenNo report executionYesNo
Mavenreport bound to verify, you ran mvn testYesNo
MavenNo prepare-agent executionNoNo
MavenSurefire <argLine> without @{argLine}NoNo
Maven<forkCount>0</forkCount>NoNo
Maven-DskipTests, or jacoco:report after mvn compileNoNo
Gradlegradle test without jacocoTestReportYesNo
Gradlegradle jacocoTestReport on its own after cleanNoNo (task skipped)
A grid of eight setups against two outputs, jacoco.exec and the report. The working setup and argLine with @{argLine} write both. No report execution, the report bound to verify and gradle test without finalizedBy write only jacoco.exec. No prepare-agent, a replacing argLine and forkCount 0 write neither.
What each setup left on disk, reproduced with JaCoCo 0.8.16.

We reproduced each one with JaCoCo 0.8.16, Maven 3.9.16, Surefire 3.5.4 and Gradle 9.7.1 on JDK 26, on a small project whose working setup writes the report on mvn test.

The Maven setup that works

<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <version>0.8.16</version>
  <executions>
    <execution><goals><goal>prepare-agent</goal></goals></execution>
    <execution>
      <id>report</id><phase>test</phase><goals><goal>report</goal></goals>
    </execution>
  </executions>
</plugin>

prepare-agent puts -javaagent:…org.jacoco.agent-0.8.16-runtime.jar into the argLine property; Surefire passes it to the forked test JVM. The report execution, bound to test, writes target/site/jacoco. Bind it to verify if you prefer, and then run mvn verify.

Surefire argLine: the most common cause

<configuration>
  <argLine>-Xmx512m</argLine>
</configuration>

This replaced the agent’s argLine. The tests ran without the agent, no jacoco.exec was written, and the report goal printed “Skipping JaCoCo execution due to missing execution data file”. Keep the agent with late property evaluation:

<configuration>
  <argLine>@{argLine} -Xmx512m</argLine>
</configuration>

The report came back. <forkCount>0</forkCount> fails the same way: the tests run inside Maven’s own JVM, where the agent was never attached.

Gradle

tasks.test {
    finalizedBy(tasks.jacocoTestReport)
}

The jacoco plugin records build/jacoco/test.exec on every gradle test, but writes the report only when jacocoTestReport runs. finalizedBy runs it after every test run; gradle test jacocoTestReport works too. gradle jacocoTestReport alone does not run the tests: after clean it was skipped. Setting jvmArgs on the test task did not break the report, unlike Maven’s argLine.

What Supercov adds

npx supercov -- mvn test
npx supercov runs latest gaps

Supercov attaches its own measurement to the build it runs, so a missing agent or report goal does not apply. It records which test covered each line, with branches and MC/DC. See JaCoCo exclude to leave classes out of the report, JaCoCo aggregate report for a multi-module build, and Java code coverage tools for the alternatives.

More coverage guides