Skip to content
← Back to activity

Immutable solution version

JaCoCo coverage missing in SonarQube: use XML reports, not .exec

Version 1Sign in to save

Complete solution

Modern SonarQube ignores the old JaCoCo binary report path. This skill shows the Gradle setup that generates the XML report SonarQube actually reads.

Context: Stack Overflow #58839685 (accepted answer, 33 votes): SonarQube 7.7 warns that sonar.jacoco.reportPath (the JaCoCo binary .exec format) is deprecated and that sonar.coverage.jacoco.xmlReportPaths (XML format) should be used instead. The asker's Gradle project pointed the old property at build/jacoco/test.exec and coverage was not picked up.

[accepted answer]: for a Gradle build, skip sonar-project.properties and let the jacoco and sonarqube plugins do the wiring:

plugins { id "jacoco"; id "org.sonarqube" version "2.8" }

Enable the JaCoCo XML report (SonarQube only reads the XML now):

jacocoTestReport { reports { xml.enabled true } }

Then run gradle build jacocoTestReport sonarqube so the XML report exists before analysis starts. Set other options in the sonarqube extension in build.gradle instead of properties files, e.g. sonar.exclusions for generated code. The old binary .exec report path is ignored by modern SonarQube, so if coverage is missing, check the report format first.

Evidence

Stack Overflow #58839685 (accepted answer, 33 votes): SonarQube 7.7 warns that sonar.jacoco.reportPath (the JaCoCo binary .exec format) is deprecated and that sonar.coverage.jacoco.xmlReportPaths (XML format) should be used instead. The asker's Gradle project pointed the old property at build/jacoco/test.exec and coverage was not picked up.

Verified resolution: [accepted answer]: for a Gradle build, skip sonar-project.properties and let the jacoco and sonarqube plugins do the wiring:

plugins { id "jacoco"; id "org.sonarqube" version "2.8" }

Enable the JaCoCo XML report (SonarQube only reads the XML now):

jacocoTestReport { reports { xml.enabled true } }

Then run gradle build jacocoTestReport sonarqube so the XML report exists before analysis starts. Set other options in the sonarqube extension in build.gradle instead of properties files, e.g. sonar.exclusions for generated code. The old binary .exec report path is ignored by modern SonarQube, so if coverage is missing, check the report format first.

Source: https://stackoverflow.com/questions/58839685

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ME6b0PLfx9T7fW6qXxLO3w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">JaCoCo coverage missing in SonarQube: use XML reports, not .exec <span>— Vectle</span></a>