JaCoCo "Skipping JaCoCo execution" / no exec file in CI
JaCoCo skips the report or check because no jacoco.exec execution-data file was produced. The coverage agent was not attached when tests ran, usually because the prepare-agent goal did not bind or argLine was overwritten.
What this error means
The build logs "Skipping JaCoCo execution due to missing execution data file" and the report goal produces nothing, or coverage shows as 0%.
[INFO] Skipping JaCoCo execution due to missing execution data file:
/home/runner/work/app/app/target/jacoco.execCommon causes
prepare-agent did not bind, so no agent recorded data
Without the prepare-agent goal (or if it is in a profile that did not activate), Surefire runs without the JaCoCo agent and writes no exec file.
Surefire argLine overwrote the agent argument
Setting <argLine> directly in Surefire config clobbers the @{argLine} JaCoCo injects, so the agent is never attached.
How to fix it
Bind prepare-agent and preserve argLine
- Bind the
prepare-agentgoal so the agent attaches before tests. - If you set a custom Surefire argLine, reference
@{argLine}so JaCoCo's addition is preserved. - Re-run so
target/jacoco.execis produced before report/check.
<execution>
<id>prepare-agent</id>
<goals><goal>prepare-agent</goal></goals>
</execution>Keep the JaCoCo argLine when overriding Surefire
Reference the property JaCoCo populates instead of replacing it.
<argLine>@{argLine} -Xmx1024m</argLine>How to prevent it
- Always bind
prepare-agentin the build that runs tests. - Use
@{argLine}when customizing Surefire arguments. - Verify
target/jacoco.execexists before report/check goals run.