Skip to content
Latchkey

Maven JaCoCo "Coverage checks have not been met" - Fix in CI

The jacoco-maven-plugin check goal compared measured coverage against a configured minimum and the ratio was below it. The build fails by design - a coverage gate, not a flaky failure.

What this error means

The build fails (usually in verify) with Coverage checks have not been met and a Rule violated for ... lines covered ratio is 0.62, but expected minimum is 0.80 line per breached rule.

mvn output
[ERROR] Failed to execute goal
org.jacoco:jacoco-maven-plugin:0.8.12:check (jacoco-check) on project app:
Coverage checks have not been met. See log for details.
[WARNING] Rule violated for bundle app: lines covered ratio is 0.62,
but expected minimum is 0.80

Common causes

Coverage dropped below the configured minimum

New code without tests, or removed tests, pushed the covered ratio under the threshold the check rule enforces.

Exec data missing so coverage reads as zero

If the prepare-agent goal did not run (or tests were skipped), JaCoCo has no exec data and measures near-zero coverage, failing the check.

How to fix it

Add tests to raise coverage

Identify the under-covered classes from the report and add tests for them.

Terminal
mvn -B verify
# HTML report: target/site/jacoco/index.html

Ensure the agent runs, or adjust the rule

Bind prepare-agent before tests, and set the threshold to a realistic, agreed minimum.

pom.xml (jacoco)
<rule>
  <element>BUNDLE</element>
  <limits>
    <limit>
      <counter>LINE</counter>
      <value>COVEREDRATIO</value>
      <minimum>0.80</minimum>
    </limit>
  </limits>
</rule>

How to prevent it

  • Bind prepare-agent before the test phase so exec data is always collected.
  • Track coverage trends so a drop is caught before it breaches the gate.
  • Set thresholds to an agreed, realistic minimum and ratchet up gradually.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →