JaCoCo import troubleshooting

This guide will help you diagnose and resolve issues related to JaCoCo coverage import on SonarQube/SonarCloud. Principles apply to all sorts of coverage reports, though there are few caveats specific to JaCoCo.

Problems you have

  • Your coverage displays 0%?
  • It dropped after a SonarQube upgrade?
  • You had a coverage value on the project Dashboard and suddenly nothing?
  • Your coverage is really low compared to what is expected?
  • Figures don’t match between JaCoCo and what’s reported by SonarQube?


SonarQube do not compute coverage nor create reports, this is on JaCoCo side and must be done prior to your project analysis. SonarQube will import JaCoCo XML reports to compute coverage metrics and display them in the User Interface.

If you are not familiar with this, please start by reading the Importing JaCoCo coverage report in XML format guide.

It is important to have a report which matches the code being analyzed, hence generated after build and tests steps, not reused from a previous build.

​Troubleshooting steps

​1. Do you use a valid JaCoCo version?

JaCoCo recommends to always use their latest released version. Check their homepage to know what it is.

​2.​ Do you have proper reports?

Generating coverage information and reports is not related to SonarQube. You have to confirm that one or several reports are generated for your project.

If you have issues generating coverage information for your project, you must work that out on the JaCoCo side as it cannot be solved by SonarQube nor this Community forum. Check the JaCoCo documentation which has needed information and examples.

​3.​ Are these reports in the XML format?

SonarQube only supports the XML format. JaCoCo binary format (.exec) cannot be imported.

The guide Importing JaCoCo coverage report in XML format will help you to configure your Maven or Gradle projects to generate XML reports.

​4.​ Do reports contain valid information for the expected set of files?

An XML report can be opened and browsed to check the information it contains. You can check what information you have for some example files and answers questions like:

  • Is the file present?
  • Is the file reported with a valid path?
  • Does it have not-null coverage information?

Again, if there are issues at this stage, you must work on the JaCoCo side, SonarQube cannot help at this stage.

​5.​ Do you use the right parameter to import them?

There is only one parameter in the SonarQube scanner to import JaCoCo reports: sonar.coverage.jacoco.xmlReportPaths

  • Are you sure this parameter is used? To confirm this, you can check the Scanner Context of your analysis.
    On SonarQube, go on your Project homepage > Project Settings > Background Tasks > Cogwheel of the related Background Task > Show Scanner Context. Be careful, for space saving reasons, this data only lasts for 7 days in SonarQube.
  • Are you sure it has no typo?

​6.​ Do you refer to reports using valid paths?

The path can be relative or absolute, it also supports wildcards. See the Test Coverage & Execution documentation for more information about this. You must make sure paths you use are valid to find your reports.

​7.​ Does SonarQube import reports?

You can check if the scanner sees your reports and import them. In your logs you should review what happens during the Sensor execution. To do this look for Sensor JaCoCo XML Report Importer [jacoco] and what it says right after. You will find one of these sensor executions for each module.

Turning on the analysis debug mode will tell you exactly which reports are imported. To turn on the debug mode:

  • Add the -X parameter if you call the SonarScanner directly
  • Add the -X parameter to your mvn command if you use the SonarScanner for Maven
  • Add the -D parameter to your Gradle command if you use the SonarScanner for Gradle

​8.​ Do files in reports match what the scanner indexes?

Paths in the report are resolved by SonarQube from each module folder. You have to make sure that they match what the scanner indexes.

Using the scanner debug mode allows you to see the list of files being indexed by the scanner (ie. all what it can see). You can then check that the module part of the path corresponds to what is in the report.

​Other specific problems

Coverage % differs between JaCoCo and Sonarqube

Check the JaCoCo coverage is different on SonarQube guide to find out.

​Using Lombok and having inconsistent coverage?

Make sure you have the right Lombok configuration using the Getting meaningful coverage results in SonarQube when using JaCoCo and Lombok guide.

​You have a multi-module setup?

As the aggregation of module reports must be done carefully, we wrote a specific Multi-Module section in the Importing JaCoCo coverage report in XML format guide.