I have a multi module maven project and trying to run scan with code coverage. I am following these documents and configured my project accordingly. The aggregate report is generated and I can publish it to Azure DevOps but when I publish it to sonar cloud using the sonar commands specified in the documents, i dont see the coverage results in my branch in sonar cloud. Whats missing from the documentation?
What do the logs say about importing code coverage?
Well, it sure looks like coverage should be imported.
2024-07-23T18:23:45.9513316Z [INFO] 11:23:45.946 Sensor JaCoCo XML Report Importer [jacoco]
2024-07-23T18:23:45.9552809Z [INFO] 11:23:45.951 Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
2024-07-23T18:23:45.9606243Z [DEBUG] 11:23:45.955 Reading report '/home/itops/myagent2/_work/1/s/Source/ims/aggregator/target/site/jacoco-aggregate/jacoco.xml'
2024-07-23T18:23:46.0113015Z [INFO] 11:23:46.008 Sensor JaCoCo XML Report Importer [jacoco] (done) | time=62ms
You might be facing an issue we plan on fixing soon, where PRs with 0 New Lines to Cover don’t show coverage information.
Can you check the Measures > Coverage section of your PR to see if you have any lines to cover?
If there are 0, it probably means you have everything configured correctly (and it will work on the main branch), and you’re just facing a display issue we have in the backlog.
after merging the code to main branch, i am able to see the coverage for overall code. But the coverage percentage in sonar doesn’t match the jacoco aggregate report published to azure devops. what could be the problem?
You’ll have to narrow it down to a specific discrepancy to investigate! Feel free to share an example, screenshots…