# SonarJava 5.13.1.18282 silently ignores JaCoCo XML report

**URL:** <https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021>\
**Category:** SonarQube Server / Community Build\
**Tags:** jacoco, java\
**Created:** [July 18, 2019, 6:52am UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021 "2019-07-18T06:52:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eetami](https://avatars.discourse-cdn.com/v4/letter/e/ee59a6/32.png) [@Eetami](https://community.sonarsource.com/u/Eetami)\
**Post date:** [July 18, 2019, 6:52am UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/1 "2019-07-18T06:52:07Z")

</div>

## Versions used

- SonarQube version 6.7.7
- SonarJava version 5.13.1.18282

The [JaCoCoSensor](https://github.com/SonarSource/sonar-java/blob/master/java-jacoco/src/main/java/org/sonar/plugins/jacoco/JaCoCoSensor.java) sensor in SonarJava project has deprecated the property `sonar.jacoco.reportPaths` in favor of `sonar.coverage.jacoco.xmlReportPaths` which is silently ignored and not analyzed.

To make things worse `sonar.coverage.jacoco.xmlReportPaths` is defined by default, meaning that if such an XML report exists in any of the default locations (in e.g. `target/site/jacoco/jacoco.xml` in Maven builds) it will override all deprecated reports (such as `jacoco.exec`).

## Steps to reproduce

The behaviour can be observed in the following Maven setups:

### Without sonar.jacoco.reportPaths property

1. Using `jacoco-maven-plugin` generate report with the `report` goal. This generates both an HTML and an XML report.
2. Invoke sonar-scanner in debug mode, the following log will be printed:

```auto
09:33:20.940 INFO: Sensor JaCoCoSensor [java]
09:33:20.944 DEBUG: JaCoCo XML report found, skipping processing of binary JaCoCo exec report.
09:33:20.944 INFO: Sensor JaCoCoSensor [java] (done) | time=4ms

```

1. Coverage is set to `0.0%` in SonarQube

### With sonar.jacoco.reportPaths property

1. Using `jacoco-maven-plugin` generate report with the `report` goal. Once again this generates both and HTML and XML report.
2. Invoke sonar-scanner in debug mode, the following log will be printed:

```auto
09:35:52.190 INFO: Sensor JaCoCoSensor [java]
09:35:52.194 INFO: Both 'sonar.jacoco.reportPaths' and 'sonar.coverage.jacoco.xmlReportPaths' were set. 'sonar.jacoco.reportPaths' is deprecated therefore, only 'sonar.coverage.jacoco.xmlReportPaths' will be taken into account.
09:35:52.194 DEBUG: JaCoCo XML report found, skipping processing of binary JaCoCo exec report.
09:35:52.194 INFO: Sensor JaCoCoSensor [java] (done) | time=4ms

```

1. Coverage is once again set to `0.0%` in SonarQube.

## Workarounds

So far the only workaround I’ve found is by either…

1. … not generating a report at all (i.e. run only `prepare-agent` goal) or…
2. … removing the generated XML report manually

Both are suboptimal solutions, as for debugging purposes we would still like to store the HTML report, but do not want to make workaround steps in our otherwise robust CI pipelines.

Either way, by not having the XML report around we can observe the following log:

```auto
09:42:14.172 INFO: Sensor JaCoCoSensor [java]
09:42:14.176 WARN: Property 'sonar.jacoco.reportPaths' is deprecated (JaCoCo binary format). 'sonar.coverage.jacoco.xmlReportPaths' should be used instead (JaCoCo XML format).
09:42:14.197 INFO: Analysing C:\Users\elindqvi\Repositories\service-orchestration\altiplano-driver\target\jacoco.exec
09:42:14.306 INFO: Sensor JaCoCoSensor [java] (done) | time=134ms

```

and finally get the appropriate coverage percent in SonarQube.

Other workaround is to install sonar-jacoco plugin (which — as far as I can see — has fixed the issue) for SonarQube, but unfortunately I’m not our SonarQube instance administrator.

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [July 18, 2019, 7:01am UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/2 "2019-07-18T07:01:57Z")

</div>

> [@Eetami](#):
>
> unfortunately I’m not our SonarQube instance administrator.

Maybe a stupid question, but can you ask your instance administrator?

---

<div class="post-metadata">

**Author:** ![Eetami](https://avatars.discourse-cdn.com/v4/letter/e/ee59a6/32.png) [@Eetami](https://community.sonarsource.com/u/Eetami)\
**Post date:** [July 18, 2019, 7:03am UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/3 "2019-07-18T07:03:52Z")

</div>

I can. Although in a big company like ours, changes happen very slowly.

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [July 18, 2019, 7:10am UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/4 "2019-07-18T07:10:27Z")

</div>

You can tell them that support for importing the .exec format at all will be removed in the next major version of SonarJava, so the sooner they let people import the XML format the less pain there will be for them down the line! 😃

That aside, I’ll be honest that I also find this a little sub-optimal. However it is also a temporary pain and pushes users to move to the XML format sooner if they’re already generating the correct reports.

---

<div class="post-metadata">

**Author:** ![saberduck](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/saberduck/32/27_2.png) [@saberduck](https://community.sonarsource.com/u/saberduck)\
**Post date:** [July 18, 2019, 7:48am UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/5 "2019-07-18T07:48:20Z")

</div>

hello @Eetami,

do you know why XML report doesn’t produce coverage information in SonarQube? When we deprecated the binary report we designed it this way, because it seems to me that using XML report is always superior to the binary report. So I would like to understand why binary report works and XML report doesn’t in your case.

---

<div class="post-metadata">

**Author:** ![Eetami](https://avatars.discourse-cdn.com/v4/letter/e/ee59a6/32.png) [@Eetami](https://community.sonarsource.com/u/Eetami)\
**Post date:** [July 18, 2019, 8:02am UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/6 "2019-07-18T08:02:05Z")

</div>

It’s because SonarJava’s [JaCoCoSensor](https://github.com/SonarSource/sonar-java/blob/master/java-jacoco/src/main/java/org/sonar/plugins/jacoco/JaCoCoSensor.java) does not actually process the XML report at all, but instead delegates that to JaCoCo plugin that has its own [JacocoSensor](https://github.com/SonarSource/sonar-jacoco/blob/master/src/main/java/org/sonar/plugins/jacoco/JacocoSensor.java) implementation as well.

Though I feel dumb now that our SonarQube administrator installed the JaCoCo plugin 5 seconds after I sent a support request. So for us this issue is fixed.

I propose that SonarJava plugin would handle the situation by printing a clear notification that JaCoCo plugin is needed for processing XML reports.

---

<div class="post-metadata">

**Author:** ![saberduck](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/saberduck/32/27_2.png) [@saberduck](https://community.sonarsource.com/u/saberduck)\
**Post date:** [July 18, 2019, 8:26am UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/7 "2019-07-18T08:26:30Z")

</div>

Ok, I overlooked that you are on 6.7. where sonar-jacoco is not shipped by default. Indeed this will happen when the plugin processing XML report is missing. We decided to accept it, as it should not concern so many users and there is easy workaround (installing the plugin).

---

<div class="post-metadata">

**Author:** ![saberduck](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/saberduck/32/27_2.png) [@saberduck](https://community.sonarsource.com/u/saberduck)\
**Post date:** [July 18, 2019, 1:19pm UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/9 "2019-07-18T13:19:20Z")

</div>

I created following ticket to improve the log message to mention that sonar-jacoco is required to process the XML report

[https://jira.sonarsource.com/browse/SONARJAVA-3164](https://jira.sonarsource.com/browse/SONARJAVA-3164)

---

<div class="post-metadata">

**Author:** ![rubensa](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/rubensa/32/16775_2.png) [@rubensa](https://community.sonarsource.com/u/rubensa)\
**Post date:** [November 9, 2020, 6:49pm UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/11 "2020-11-09T18:49:31Z")

</div>

> [@saberduck](#):
>
> Ok, I overlooked that you are on 6.7. where sonar-jacoco is not shipped by default. Indeed this will happen when the plugin processing XML report is missing. We decided to accept it, as it should not concern so many users and there is easy workaround (installing the plugin).

I don’t think there is an easy workaround.  
I’m on **SonarQube 6.7.1**. The **JaCoCo** plugin available in **Marketplace** is **1.1.0 (build 898)**. When I try to install it says: “ **Error while downloading plugin ‘jacoco’ with version ‘1.1’. No compatible plugin found.** ”

So I’m stuck. I can’t use neither j **avococo.exec** nor **jacoco.xml**. ☹

---

<div class="post-metadata">

**Author:** ![rubensa](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/rubensa/32/16775_2.png) [@rubensa](https://community.sonarsource.com/u/rubensa)\
**Post date:** [November 10, 2020, 2:07pm UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/12 "2020-11-10T14:07:46Z")

</div>

As stated [here](https://community.sonarsource.com/t/error-while-downloading-plugin-any-plugin-with-version-version-no-compatible-plugin-found/19361) looks like old releases are **removed after 18 months** so…  
Can I download and install “manually” and old plugin version?

---

<div class="post-metadata">

**Author:** ![rubensa](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/rubensa/32/16775_2.png) [@rubensa](https://community.sonarsource.com/u/rubensa)\
**Post date:** [November 10, 2020, 2:19pm UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/13 "2020-11-10T14:19:09Z")

</div>

Umm… [looks](https://github.com/SonarSource/sonar-update-center-properties/blob/master/jacoco.properties) like I can manually download a compatible version from [https://binaries.sonarsource.com/Distribution/sonar-jacoco-plugin/sonar-jacoco-plugin-1.0.2.475.jar](https://binaries.sonarsource.com/Distribution/sonar-jacoco-plugin/sonar-jacoco-plugin-1.0.2.475.jar) and [then](https://community.sonarsource.com/t/installing-plugins-manually-in-sonarcloud-or-sonarqube-for-azure-devops/6518) put it inside **$SONARQUBE\_HOME/extensions/plugins**  
🤔

Also seen at [Manual install - Download link](https://community.sonarsource.com/t/manual-install-download-link/33888/2)

---

<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:** [November 17, 2020, 2:19pm UTC](https://community.sonarsource.com/t/sonarjava-5-13-1-18282-silently-ignores-jacoco-xml-report/12021/14 "2020-11-17T14:19:19Z")

</div>

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