I have integrated SonarQube & Jacoco plugin in our project, Issue is
When I try to run it on localhost:9000 it is working fine and giving the code coverage and picking the sonar.coverage.jacoco.xmlReportPaths from the specified location, but when we deploy it on Jenkins then code coverage not working we are getting a message in the Jenkins console like below:
No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths=‘app/build/reports/jacocoTestReport/jacocoTestReport.xml’. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
I hope this would help… 17:28:29 11:58:29.669 INFO: Sensor JaCoCo XML Report Importer [jacoco]
17:28:29 11:58:29.675 WARN: No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths=‘app/build/reports/jacoco/test/jacocoTestReport.xml’. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
17:28:29 11:58:29.675 INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
Sorry but what you shared is not sufficient. You may redact what you don’t want to disclose but I need to see more.
Related to the log: **17:28:29** 11:58:29.675 WARN: No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths=‘app/build/reports/jacoco/test/jacocoTestReport.xml’. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
We should verify if and where is generated the Jacoco report (I should not be in app/build/reports/jacoco/test/jacocoTestReport.xml) and that’s why coverage is not imported.
So if the report files are missing in your pipeline, it’s normal that SonarQube does not report any coverage.
Sorry but my community support is limited to helping on SonarQube problem. In that case it seems to be a pipeline problem and I cannot help on this. I am not even an expert in that domain. You should seek help from Gradle experts to understand why the Jacoco XML report is not generated. You may also read this community guide if that can be of any help.