We are using Azure devops pipeline with sonar cloud integration and code coverage is showing in Azure Interface pipeline code coverage tab as shown in attachment but not showing in sonar cloud. Tasks sequence shown in screenshot below.
In prepare analysis for sonar cloud task, path is explicitly set where jacoco.xml is available,sonar.coverage.jacoco.xmlReportPaths=/home/vsts/work/1/s/development/CCReport43F6D5EF/jacoco.xml and same is set in maven/pom.xml options as
-Dsonar.coverage.jacoco.xmlReportPaths=/home/vsts/work/1/s/development/CCReport43F6D5EF/jacoco.xml
Can you point why the coverage is not coming in sonar cloud.
The options field in the Maven task is definitely not a good place to put any properties for the SonarCloud analysis.
Prepare analysis configuration can be, but make sure you don’t put any -D in front of the property, you can simply put “sonar.coverage.jacoco.xmlReportPaths=/home/vsts…” in the additional properties field.
Make sure also that you don’t set that property twice, so either choose the pom.xml of the additional property fields, it will help you troubleshoot in that specific case.
Hi @mickaelcaro - Path is correct. But it is setting both -Dsonar.jacoco.reportPaths and -Dsonar.coverage.jacoco.xmlReportPaths and looks on sonar cloud its not able to read Dsonar.coverage.jacoco.xmlReportPaths
as warning is coming on sonarcloud interface
Property ‘sonar.jacoco.reportPaths’ is no longer supported. Use JaCoCo’s xml report and sonar-jacoco plugin.
sonar.jacoco.reportPaths can be set for some cases where it should be still supported (older version of SQ and subsequent analyzers for instance).
The sonar.coverage.jacoco.xmlReportPaths is set automatically by the Maven task, so finally, you don’t need to set it up on your own as long as you are relying on default paths for the coverage xml file to be written.
We are not trying to use it, but as it is not supported anymore on our side, we are stil detecting it and display a warning that is shouldn’t be used anymore.
ok @mickaelcaro. So need to identify why sonar cloud is not able to read the jacoco.xml from azure though same works fine when its run from local set up.