Jacoco coverage isn't shown on Sonarqube server

Trying to make use of existing Jenkins plugin “SonarQube Scanner for Jenkins” to push the jacoco coverage report to the sonar server. Snapshot of the sonar.properties:

sonar.projectKey= **
sonar.test.inclusions=**/test/**
sonar.java.binaries=**/classes/**
sonar.java.libraries=**
sonar.coverage.exclusions=**/*.html,**/*.css,**/*.png,**/*.jpg,**/*.JPG,**/io/ionic*,**/io/ionic**,**/io/ionic**/*.java,**/org/*,**/org/**,**/org/**/*.java,**/cordova/*,**/cordova/**,**/cordova/**/*.java,**/android/*,**/android/**,**/android/**/*.java,**/apache/commons/** 
sonar.coverage.jacoco.xmlReportPaths={module path}/build/reports/jacoco/test/jacocoTestReport.xml 
sonar.dependencyCheck.htmlReportPath={module path}/build/reports/dependency-check-report.html

Now, this works fine and upload the coverage to the local sonarqube server but the same config doesn’t work when run from Jenkins to push.

Had a look at the Jenkins logs but it doesn’t have any error. However, it successfully uploads the Dependenc check report to the error.

  • versions(SonarQube - CE 8.3.1 and Sonarqube scanner for Jenkins - 2.11

Any help here would be highly appreciated!

Thanks in advance

Hello,

Typically, you could remove the {module path} part. Of course, depending on your configuration, this can change, but the fact that everything is working locally makes me think that it might be a problem of paths, I would investigate in this direction if I were you.

In any case, you should see logs if there is a problem during import or if everything went fine. They are reported as warn or info and debug, you may want to make sure level is correctly setup to see precisely what is happening.

Example of correct execution with a simple maven project:

sonar.coverage.jacoco.xmlReportPaths="target\site\jacoco-ut\jacoco_1.xml"
[INFO] 11:29:10.289 Sensor JaCoCo XML Report Importer [jacoco]
[INFO] 11:29:10.293 Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
[DEBUG] 11:29:10.297 Reading report '[Absolute path to project]\target\site\jacoco-ut\jacoco_1.xml'
[INFO] 11:29:10.310 Sensor JaCoCo XML Report Importer [jacoco] (done) | time=21ms

I hope this helps.