Sonarqube is not picking code coverage report generated by jacoco

I added sonar plugin in pom.xml. Still sonarqube is not able to generate the code coverage report.
plugin added :



		<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>		 <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>

Error message from jenkins build log:
[WARNING] No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths=‘/tmp/workspace/testapi-job_master@unit_tests/./target/site/jacoco/jacoco.xml’. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
[INFO] No report imported, no coverage information will be imported by JaCoCo XML Report Importer

Hey there.

When you run your Maven build, what is the actual filepath of the JaCoCo XML report being produced?

Remember that SonarQube isn’t involved in generating the report, only reading the report from where it’s told (or checking the default locations).

Hi Colin,

When I run sonar locally jacoco report is being generated at “'/Users/Documents/IdeaProjects/testApi/target/site/jacoco/jacoco.xml”. And sonar picked the report.

But when code is pushed jenkins, sonar not able to identify the location.

Is the JaCoCo report itself produced when run in Jenkins?

Hi colin,
Yes. I defined the plugin details in pom.xml

I think it’s important that you actually check if/where the JaCoCo report is being produced on the build machine, and ensure that if it’s not in the locations that the scanner is checking by default (as logged in the scanner logs), you configure sonar.coverage.jacoco.xmlReportPaths