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 :

<profiles>
		<profile>
			<id>coverage</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<build>
				<defaultGoal>install</defaultGoal>
				<finalName>testapi</finalName>
				<plugins>
					<plugin>
						<groupId>org.springframework.boot</groupId>
						<artifactId>spring-boot-maven-plugin</artifactId>
						<version>${project.parent.version}</version>
					</plugin>
					<plugin>
						<groupId>org.sonarsource.scanner.maven</groupId>
						<artifactId>sonar-maven-plugin</artifactId>
						<version>3.9.1.2184</version>
					</plugin>
					<plugin>
						<groupId>org.jacoco</groupId>
						<artifactId>jacoco-maven-plugin</artifactId>
						<version>0.8.6</version>
						<executions>
							<execution>
								<goals>
									<goal>prepare-agent</goal>
								</goals>
							</execution>
							<execution>
								<id>report</id>
								<phase>test</phase>
								<goals>
									<goal>report</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

properties:

<properties>
		<java.version>11</java.version>
		<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
		<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>		 <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
		<jacoco.version>0.8.6</jacoco.version>
		<sonar.language>java</sonar.language>
	</properties>

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