Must-share information (formatted with Markdown):
Which versions we are using
- SonarQube Enterprise : 8.9.7 LTS
- Jacoco version : 0.8.1
- SonarQube gradle plugin : 3.2.0
- JAVA version : corretto-8.342.07.3
- Gradle version : 6.9.2
What we are trying to achieve
The goal is to gather code coverage from remote jacoco agents and supply the combined code coverage report to SonarQube
Expected Outcome: The coverage data is successfully imported into SonarQube
Actual Outcome: The debug logs report that the xml coverage report produced as input has been processed but is not reflected in SonarQube
Additional Background Information
We have a multi module gradle project that produces a set of output artifacts. These artifacts are consumed by another top level project that combines these jars with ones from other projects to produce a deployable artifact.
There are X number of applications produced, all running with a jacoco java agent to instrument the code for collecting coverage information.
We run a suite of automated UI tests and gather code coverage after tests have been executed.
Within the multi module project above, I have created a separate project responsible for gathering all the coverage data and producing a combined coverage report.
The xml and html report are being produced without an issue. When running the sonarqube task, I can see the following output to suggest that the report has been acknowledged.
[INFO] [org.sonarqube.gradle.SonarQubeTask] Sensor JaCoCo XML Report Importer [jacoco]
[INFO] [org.sonarqube.gradle.SonarQubeTask] Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
[DEBUG] [org.sonarqube.gradle.SonarQubeTask] Reading report '<absolute path to jacoco agent xml report>'
What we have tried so far to achieve this
I noticed that the jacoco agent version used by our remote deployment did not align with the agent running for unit tests.
Having investigated the code for the jacoco sensor, there appears to be very little logging in this area to provide more insightful feedback. There’s an open PR for this that someone else has produced so it seems to be a common issue - Add some logs by Dufgui · Pull Request #41 · SonarSource/sonar-jacoco · GitHub