CheckOps home

Tools directory

J

CheckOps

JaCoCo

JaCoCo is a free Java code coverage library under the Eclipse Public License 2.0, measuring instruction, branch, line, method and class coverage via a Java agent, with Maven, Gradle, Ant and CLI integrations.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

Introduction

JaCoCo (Java Code Coverage) is a free code coverage library for Java, distributed under the Eclipse Public License 2.0. It was created by the EclEmma team, who also maintain the EclEmma coverage plugin for Eclipse, and it has become the default coverage engine for the JVM.

JaCoCo works through a Java agent that instruments classes on the fly as they load, so you do not need to change your build output. It records execution data into an .exec file, and report tasks turn that data into HTML, XML and CSV reports. The XML format is consumed by many tools, including SonarQube, Codecov, Coveralls and CI dashboards.

Its README points to integrations for Maven, Ant, a command-line interface and many others listed in the documentation, and Gradle ships a built-in jacoco plugin. Version 0.8.16 was released on 26 October 2026; JaCoCo’s version numbers have stayed in the 0.8.x series for years while adding support for new Java releases.

How it compares: older tools such as Cobertura and Emma are no longer maintained, and IntelliJ IDEA’s own coverage runner is mainly used inside the IDE. JaCoCo’s combination of on-the-fly instrumentation, offline instrumentation for special environments and wide tool support makes it the common choice for CI. Coverage itself is only a signal: mutation testing tools such as PIT show whether covered code is actually checked by assertions.

In the quality loop, JaCoCo runs with unit and integration tests and often feeds a release gate, for example failing the build if branch coverage on changed code drops below a threshold.

The source code is at jacoco/jacoco on GitHub under the EPL-2.0 licence, with about 4,600 stars; the most recent commit was on 11 November 2026.

Coverage counters deserve a short explanation because they differ from what many tools report. JaCoCo’s smallest unit is the bytecode instruction, which is independent of formatting, so instruction coverage is more precise than line coverage. Branch coverage counts the outcomes of if and switch statements, which is usually the most informative metric for business logic. The HTML report colours each source line red, yellow or green, where yellow means partly covered branches, and shows diamonds in the margin with the number of missed branches. Since version 0.8.0, JaCoCo also filters compiler-generated code, such as synthetic methods, try-with-resources bytecode and parts of Kotlin and Lombok output, so reports focus on code you wrote.

Features

  1. Coverage counters: Instructions, branches, lines, methods, classes and cyclomatic complexity.
  2. On-the-fly instrumentation: A Java agent instruments classes at load time with low overhead.
  3. Offline instrumentation: Pre-instrument classes for environments where agents cannot be used.
  4. Reports: HTML for people, XML and CSV for tools.
  5. Coverage checks: check goals enforce minimum ratios and fail the build when they are not met.
  6. Merging: Combine execution data from unit tests, integration tests and multiple modules.
  7. Build integrations: Maven plugin, Gradle plugin, Ant tasks and a CLI.
  8. Remote and runtime use: Dump execution data from running JVMs via TCP, useful for manual or system-test coverage.

Pros

  1. The JVM standard: Read by SonarQube, Codecov, Coveralls and most CI tools.
  2. Low overhead: Fast enough to leave on in CI for every build.
  3. Free to use: Open source under the EPL-2.0 licence, so the core tool costs nothing to use.
  4. Actively maintained: The repository had commits as recent as 11 November 2026.
  5. Community: About 4,600 GitHub stars.

Cons

  1. Coverage is not quality: High coverage does not prove good assertions; pair it with mutation testing.
  2. Multi-module setup: Aggregating reports across modules needs extra configuration.
  3. Generated code noise: Lombok, records and frameworks can generate code that needs filtering (JaCoCo filters many cases automatically).
  4. Kotlin inline functions: Some Kotlin constructs are reported less precisely than plain Java.

Enable JaCoCo in Maven:

<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>verify</phase><goals><goal>report</goal></goals></execution>
  </executions>
</plugin>

Or in Gradle (Kotlin DSL):

plugins { jacoco }
tasks.test { finalizedBy(tasks.jacocoTestReport) }
tasks.jacocoTestReport { reports { xml.required.set(true) } }

Enforce a minimum branch coverage:

tasks.jacocoTestCoverageVerification {
  violationRules { rule { limit { counter = "BRANCH"; minimum = "0.70".toBigDecimal() } } }
}

Practical tips:

  1. Publish the XML report to your code quality or coverage service so pull requests show coverage changes.
  2. Gate on coverage of new or changed code rather than an absolute number for legacy projects.
  3. Merge unit and integration test execution data for a truer picture.

Resources:

Pricing

JaCoCo is free and open source under the EPL-2.0 licence.

  1. Java and Kotlin teams measuring test coverage in CI.
  2. Organisations using SonarQube, Codecov or Coveralls, which read JaCoCo XML.
  3. Teams setting coverage gates on pull requests.
  4. Not a fit as the only quality metric; add mutation testing for test effectiveness.

Conclusion

JaCoCo is the de facto coverage library for the JVM: free, fast, well integrated and supported by nearly every quality tool.

Use it to find untested code and to gate changes, and pair it with mutation testing to check that covered code is genuinely verified.

Alternatives

Other tools on CheckOps that cover similar ground. Open a page, or compare one with JaCoCo side by side.