# sonar.coverage.jacoco.xmlReportPaths not reporting coverage

**URL:** <https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178>\
**Category:** SonarQube Cloud\
**Tags:** jacoco, sonarqube-cloud, coverage\
**Created:** [May 25, 2020, 1:48pm UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178 "2020-05-25T13:48:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![nbaztec](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nbaztec/32/11933_2.png) [@nbaztec](https://community.sonarsource.com/u/nbaztec)\
**Post date:** [May 25, 2020, 1:48pm UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/1 "2020-05-25T13:48:23Z")

</div>

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

`// build.gradle`

```auto
plugins {
    java
    kotlin("jvm") version "1.3.71"
    jacoco
    id("org.sonarqube") version "2.7"
}

sonarqube {
    properties {
        property("sonar.login", " ****")
        property("sonar.host.url", "https://sonarcloud.io")
        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 {
    dependsOn("test")
    dependsOn("integrationTest")

    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](https://community.sonarsource.com/uploads/short-url/AjT0AkTJ535ggctitk8SDEYo354.log) (102.2 KB)

Snippet

```nohighlight
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:

 ![Screen Shot 2020-05-25 at 15.37.51](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/7/756e3271d96598a4b53f3bc8dd3b860b574b9262.png)

 ![Screen Shot 2020-05-25 at 15.39.51](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/c/cbf6306b38ea7402dfd0c88786bedc8e8f0d5075.png)

However on SonarCloud we have no coverage reported at all:

 ![Screen Shot 2020-05-25 at 15.40.54](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/4/48770ef7d9646afd08f4fec267dbadee51fc2f09.png)

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!

Regards,  
Nisheeth Barthwal

---

<div class="post-metadata">

**Author:** ![TomVanBraband](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tomvanbraband/32/46480_2.png) [@TomVanBraband](https://community.sonarsource.com/u/TomVanBraband)\
**Post date:** [May 26, 2020, 6:45am UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/2 "2020-05-26T06:45:20Z")

</div>

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](https://jira.sonarsource.com/browse/MMF-1651) for more information).

---

<div class="post-metadata">

**Author:** ![nbaztec](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nbaztec/32/11933_2.png) [@nbaztec](https://community.sonarsource.com/u/nbaztec)\
**Post date:** [May 26, 2020, 8:29am UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/3 "2020-05-26T08:29:33Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![nbaztec](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nbaztec/32/11933_2.png) [@nbaztec](https://community.sonarsource.com/u/nbaztec)\
**Post date:** [June 2, 2020, 8:27am UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/4 "2020-06-02T08:27:21Z")

</div>

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

Thanks

---

<div class="post-metadata">

**Author:** ![dmeneses](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/dmeneses/32/2933_2.png) [@dmeneses](https://community.sonarsource.com/u/dmeneses)\
**Post date:** [June 2, 2020, 1:31pm UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/6 "2020-06-02T13:31:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![nbaztec](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nbaztec/32/11933_2.png) [@nbaztec](https://community.sonarsource.com/u/nbaztec)\
**Post date:** [June 2, 2020, 1:54pm UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/7 "2020-06-02T13:54:09Z")

</div>

> [@nbaztec](#):
>
> ```auto
> 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
> 
> ```

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.

Thanks!

--------- 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 `io.foo.bar` and that’s reflected all over the coverage report.

---

<div class="post-metadata">

**Author:** ![nbaztec](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nbaztec/32/11933_2.png) [@nbaztec](https://community.sonarsource.com/u/nbaztec)\
**Post date:** [June 2, 2020, 2:14pm UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/8 "2020-06-02T14:14:46Z")

</div>

Just confirmed. [https://github.com/SonarSource/sonar-jacoco/blob/master/src/main/java/org/sonar/plugins/jacoco/FileLocator.java#L44](https://github.com/SonarSource/sonar-jacoco/blob/master/src/main/java/org/sonar/plugins/jacoco/FileLocator.java#L44)

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.

Thanks.

---

<div class="post-metadata">

**Author:** ![dmeneses](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/dmeneses/32/2933_2.png) [@dmeneses](https://community.sonarsource.com/u/dmeneses)\
**Post date:** [June 2, 2020, 3:32pm UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/9 "2020-06-02T15:32:58Z")

</div>

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

I created a ticket: [https://jira.sonarsource.com/browse/JACOCO-16](https://jira.sonarsource.com/browse/JACOCO-16)

Thanks for reporting the problem.

---

<div class="post-metadata">

**Author:** ![nbaztec](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/nbaztec/32/11933_2.png) [@nbaztec](https://community.sonarsource.com/u/nbaztec)\
**Post date:** [June 2, 2020, 3:57pm UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/10 "2020-06-02T15:57:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [June 9, 2020, 3:57pm UTC](https://community.sonarsource.com/t/sonar-coverage-jacoco-xmlreportpaths-not-reporting-coverage/25178/12 "2020-06-09T15:57:13Z")

</div>

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