I have managed to combine multi module coverage into a JacocoReport thanks to the help of this blog post. However, I am having problems with the sonar integration.
It looks like you have some extra characters here, specifically '. at the end of your file path. Can you try removing that? It’s being interpreted literally by the scanner.
My apologies, that was a copy and paste error into my original post. Here is how I am setting the path manually property "sonar.coverage.jacoco.xmlReportPaths","build/reports/jacoco/allDebugCoverage/allDebugCoverage.xml"
This is set in my sonar.gradle file. Which I have added below. If there is any other information I can provide, can you please let me know. Thank you again for coming back to me.
No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths='build/reports/jacoco/allDebugCoverage/allDebugCoverage.xml'. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
I had copied the first line of the log and in error included the full stop. So the copy and paste error was me copying from the logs and including . in error.
This log is indeed aligned and up to date with the path initialised in the sonar config I’ve shared
I’m starting to wonder if the report might be getting read in by the global coverage sensor but at the module level, it can’t find a per-file module (which makes sense if it’s a merged file).
Putting the error message aside, do you actually see any coverage data on SonarCloud?
@Colin
I have also removed the implicit declaration of the path as suggested in a different post in this community to see would sonar pickup the report automatically but that hasn’t worked either unfortunately.
I removed all exclusions from sonar.exclusions in case some configuration was omitting the xml file but that hasn’t given any success either. I would really appreciate some guidance on this.
I imagine it is something small and trivial causing this issue but I cannot resolve it.
Thank you Colin for coming back to me. I’ve tried that and I get the same issue
No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths='**/jacoco/allDebugCoverage/allDebugCoverage.xml'. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
No report imported, no coverage information will be imported by JaCoCo XML Report Importer
I’ve compared the jacoco html report to the xml and they match up i.e. branches covered/missed, lines covered/missed etc so I know the xml is valid format
Let me do what I should have done in the first place and clone the playground from the blog post you linked (and install the Android SDK ). I’ll come back on this thread if I can (or can’t) reproduce it.
Great news!! This works for me! Did you notice, Is the coverage imported equal to the html file output? So for example, the html file reads 28% coverage, however, the coverage imported to sonarcloud is only 16.8%
Thank you for that. I may be veering off topic here but looking at my coverage on sonarcloud, it doesn’t recognise the separate module covered in the coverage. It’s not listed when I dig into the coverage on sonar cloud. It is listed under the xml, can you advise it if should be noted in sonar cloud?
There are three packages from the module that are included in the xml report file but aren’t listed in the coverage
If you can provide a reproducer (similar to the playground used before), I think that will help us figure out if it should be noted or not. I don’t quite understand the problem from your description.
Sonar cloud is not displaying three packages from the module. In your dashboard go to measures → coverage and view as tree map.
You should be able to reproduce it in the playground app, there are different packages in that per module. After the xml coverage report import, can you see each package in your sonar dashboard?
In my xml coverage report, all packages are there, from the separate modules and main codebase but the module packages are not displaying in sonarcloud.