sonar.coverage.jacoco.xmlReportPaths not reporting coverage

We are currently using SonarCloud to publish our coverage reports to from a Kotlin project.

// build.gradle

plugins {
    kotlin("jvm") version "1.3.71"
    id("org.sonarqube") version "2.7"

sonarqube {
    properties {
        property("sonar.login", "****")
        property("", "")
        property("sonar.organization", "<org>")
        property("sonar.projectName", "<project>")
        property("sonar.projectKey", "<org_project>")
        property("sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml")
        property("sonar.sources", "src/main")
        property("sonar.tests", "src/test")

tasks.jacocoTestReport {

    executionData(file("$buildDir/jacoco/test.exec"), file("$buildDir/jacoco/integrationTest.exec"))
    reports {
        xml.isEnabled = true
        html.isEnabled = true

Running $ gradlew jacocoTestCoverage sonarqube correctly generates the coverage report with the following build output:

output.log (102.2 KB)


2020-05-25T15:22:52.008+0200 [INFO] [org.sonarqube.gradle.SonarQubeTask] Sensor JaCoCo XML Report Importer [jacoco]
2020-05-25T15:22:52.008+0200 [INFO] [org.sonarqube.gradle.SonarQubeTask] Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
2020-05-25T15:22:52.008+0200 [DEBUG] [org.sonarqube.gradle.SonarQubeTask] Reading report '<BASE_DIR>/build/reports/jacoco/test/jacocoTestReport.xml'
2020-05-25T15:22:52.040+0200 [INFO] [org.sonarqube.gradle.SonarQubeTask] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=35ms

Generated Report:

However on SonarCloud we have no coverage reported at all:

I’ve already tried following the guides on the community forum and now am running out of ideas what could it possibly be.
JaCoCo plugin seems to be enabled and the debug reports state that the report is correctly read and I can confirm that the coverage file exists.

Any help is appreciated, thanks!

Nisheeth Barthwal

Hello @nbaztec,

Thanks for the detailed submission!
Could you try to upgrade the org.sonarqube plugin to 2.8? We made some changes in the latest version where we drop the support of the .exec format in favour of the .xml format of jacoco reports (see this ticket for more information).

1 Like

Hi @TomVanBraband

Thanks for looking in, I’ve bumped the version to 2.8 (it was previously 2.8 but I wanted to try 2.7 as they are defined in the examples on the github repo)

Nothing changed on my end, the logs still state the same and I presume I’m not using the .exec files for sonarqube at all (only to merge execution results for jacoco).

Any further suggestions? It’s a quite unfortunate not having our coverage reports in sonarcloud.


Do the file paths in the JaCoCo report don’t match the relative paths used in SonarQube?
Any chance you could provide us a simple reproducer?

As per the logs it seems to have found, read and imported the report.

It’s a bit hard to have a sample producer since this is a private repository, hence I’ve attached the gradle settings, and snippets from the file system and the logs.

I’ll see what I can do.


--------- EDIT

I re-read the comment and checked the generated coverage report. I can identify one factor that the directory structure of our main package does not match the namespace.

src/main/kotlin/Main.kt defines the root package as and that’s reflected all over the coverage report.

Just confirmed.

Moving the files to the java-style directory structure seemed to work and coverage was reported.

Is this a known bug and/or will this be fixed? Since kotlin packages don’t require (and is suggested as well) complete directory names.


Yes, looks like it’s a case we didn’t consider.

I created a ticket:

Thanks for reporting the problem.

1 Like

Thanks for opening the issue! Looking forward to having it fixed.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.