Understanding JaCoCo Execution Data Files | Generated by AI

Home 2025.09

Here’s a practical, everything-you-need rundown.

What is jacoco-it.exec?

Typical Maven setup:

<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <version>0.8.12</version>
  <executions>
    <!-- for unit tests -->
    <execution>
      <id>prepare-agent</id>
      <goals><goal>prepare-agent</goal></goals>
    </execution>
    <!-- for integration tests -->
    <execution>
      <id>prepare-agent-integration</id>
      <goals><goal>prepare-agent-integration</goal></goals>
    </execution>
    <execution>
      <id>report</id>
      <phase>verify</phase>
      <goals><goal>report</goal></goals>
    </execution>
    <execution>
      <id>report-it</id>
      <phase>verify</phase>
      <goals><goal>report-integration</goal></goals>
    </execution>
  </executions>
</plugin>

This usually writes target/jacoco.exec (unit) and target/jacoco-it.exec (integration).

What’s inside an .exec file?

Implications:

Does it contain class structure information?

Will it be updated when you attach via -javaagent?

Short answer: Yes, with details:

Common agent options:

-javaagent:/path/to/org.jacoco.agent.jar=\
destfile=/path/to/jacoco-it.exec,\
append=true,\
output=file

Other useful modes:

Notes on “updated”:

Typical workflows

Integration test phase (Failsafe):

Merging multiple runs:

# via Maven
mvn jacoco:merge -Djacoco.destFile=target/merged.exec \
  -Djacoco.dataFileList="target/jacoco.exec,target/jacoco-it.exec,other.exec"
# then
mvn jacoco:report -Djacoco.dataFile=target/merged.exec

Practical gotchas and tips


Direct answers to your questions


Back Donate