JaCoCo coverage is different in Sonar

Problem you have

  • Your JaCoCo coverage is not the same on SonarQube/SonarCloud than it is on JaCoCo

Check the following

  1. It might be expected because you are not looking at the right metrics. Read more about this in the SonarQube and code coverage guide.
  2. Your project has more than only Java/Kotlin/Scala code so when aggregated, coverage results might differs than only Java code coverage.
  3. If you are using Lombok, make sure that you have the right configuration using the Getting meaningful coverage results in SonarQube when using JaCoCo and Lombok guide.
  4. If you have coverage only for some modules, check your multi-modules setup using our Importing JaCoCo coverage report in XML format guide
2 Likes