Skip to content
Latchkey

JaCoCo "Rule violated for bundle ... lines covered ratio" in CI

The Maven jacoco:check (or Gradle jacocoTestCoverageVerification) goal compared measured coverage against a rule limit and the ratio was below the minimum, so the build fails with the exact measured and required values.

What this error means

The build fails with "Rule violated for bundle X: lines covered ratio is 0.50, but expected minimum is 0.80" and the reactor reports a JaCoCo check failure.

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

Common causes

Coverage genuinely dropped below the rule limit

New untested code lowered the covered ratio under the configured minimum (line, branch, or instruction), so the rule fails.

The rule scope or counter is stricter than intended

The rule applies at bundle level with a high minimum, or counts a stricter metric (BRANCH) than the team expects, magnifying small gaps.

How to fix it

Add tests to meet the limit, or adjust the rule

  1. Read the measured ratio and the bundle in the message.
  2. Add tests for the uncovered code, or open the HTML report to find the gaps.
  3. If the minimum is too aggressive for now, set it to a realistic value in the plugin config.
pom.xml
<limit>
  <counter>LINE</counter>
  <value>COVEREDRATIO</value>
  <minimum>0.80</minimum>
</limit>

Exclude generated code from the rule

Generated or boilerplate classes can be excluded so they do not drag the bundle ratio down.

pom.xml
<excludes>
  <exclude>**/generated/**</exclude>
  <exclude>**/*Dto.class</exclude>
</excludes>

How to prevent it

  • Run jacoco:check locally before pushing.
  • Raise the minimum gradually as coverage improves.
  • Exclude generated code so the ratio reflects real source.

Frequently asked questions

What causes ""Rule violated for bundle""?
New untested code lowered the covered ratio under the configured minimum (line, branch, or instruction), so the rule fails.
How do I fix "Rule violated for bundle"?
Add tests to meet the limit, or adjust the rule

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card