Unable to get SonarCloud to recognise generated jacoco xml coverage

Hello!

I am somewhat new with continuous systems and have been struggling to get Sonar to recognize JaCoCo’s coverage analysis.

From what I can tell, this github action workflow in this project successfully builds an xml file to /target/site/jacoco/jacoco.xml, as I am led to believe from this log.

[INFO] --- jacoco-maven-plugin:0.8.7:prepare-agent (prepare-agent) @ stargate ---
[INFO] argLine set to -javaagent:/home/runner/.m2/repository/org/jacoco/org.jacoco.agent/0.8.7/org.jacoco.agent-0.8.7-runtime.jar=destfile=/home/runner/work/Stargate-Bukkit/Stargate-Bukkit/target/jacoco.exec

[INFO] --- jacoco-maven-plugin:0.8.7:report (report) @ stargate ---
[INFO] Loading execution data file /home/runner/work/Stargate-Bukkit/Stargate-Bukkit/target/jacoco.exec
[INFO] Analyzed bundle 'StarGate' with 135 classes

[INFO] Sensor JaCoCo XML Report Importer [jacoco]
[INFO] 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
[INFO] Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=102ms

[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=0ms

Unfortunately, no matter what I do, I can’t seem to get sonar to detect jacoco (and its analysis of our unit tests). Our current prototype’s coverage is 56% which, while far from great, is more than the 0% I have been able to get sonar to show.

I’ve tried setting sonar.coverage.jacoco.xmlReportPaths to a variety of values (including leaving it blank), yet have not yet been able to get any results.

Hey there!

The logs in your action say that no tests ran :zipper_mouth_face:

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

So that’s probably the root cause of this.

Thanks for pointing that out! I was able to discover a missing dependency that was causing the problem!

1 Like

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