Sonar build issue

SonarQube Version 8.9.10
Code coverage is not reflecting the in the SonarQube for any branch of the project. It is showing as 0%
Below is the code snippet for code coverage in pom.xml file:

    <properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<java.version>11</java.version>
	<jackson.core.version>2.9.10.8</jackson.core.version>
	<sonar.host.url>https://sonarqube.pearson.com</sonar.host.url>

	<!-- <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
	<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> -->
	<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
	<!-- <sonar.sources>src/main</sonar.sources>
	<sonar.tests>src/test</sonar.tests> -->
	<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
	<sonar.language>java</sonar.language>
	<sonar.login>$SONAR_TOKEN</sonar.login> 
	<sonar.exclusions>src/main/java/com/pearson/notes/xconnect/domain/**/*,src/main/java/com/pearson/notes/xconnect/aop/**/*,src/main/java/com/pearson/notes/xconnect/configuration/**/*,src/main/java/com/pearson/notes/xconnect/exception/**/*,src/main/java/com/pearson/notes/xconnect/NotesXConnectApplication.java</sonar.exclusions>
	<sonar.java.binaries>target/classes</sonar.java.binaries>
	<sonar.projectName>notesXconnect</sonar.projectName>
	<sonar.projectKey>NotesXconnect</sonar.projectKey>
	<newrelic.version>8.0.0</newrelic.version>
</properties>


 <plugin>
			<groupId>org.jacoco</groupId>
			<artifactId>jacoco-maven-plugin</artifactId>
			<version>0.8.7</version>
			<configuration>
				<destFile>${basedir}/target/jacoco.exec</destFile>
			</configuration>
			<executions>
				<execution>
					<id>jacoco-initialize</id>
					<goals>
						<goal>prepare-agent</goal>
					</goals>
					<!--<phase>test-compile</phase>-->
				</execution>
				<execution>
					<id>jacoco-site</id>
					<phase>verify</phase>
					<goals>
						<goal>report</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
		<plugin>
		   	<groupId>org.codehaus.mojo</groupId>
			<artifactId>sonar-maven-plugin</artifactId>
			<version>3.3.0.603</version>
		</plugin>

Hi ,

Can someone please help with this request

Hi,

Welcome to the community!

I find the /../ in your report path suspicious.

Can you share your analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

Hi Ann,

This ${project.basedir}/…/target/ is target folder of the project where jacoco.exec will be generated

Performing API call with GET Method on URL: https://sonarqube.pearson.com/api/measures/component?metricKeys=coverage&component=NotesXconnect&branch=release/Release_JDK11_Upgrade

92[2023-04-24 05:27:30]

93 Line Covered Percentage: 0.0

94 Statement/Instruction Percentage: 0.0

95 Branch Percentage: 0.0

96 Function/Method Percentage: 0.0

97 Code Coverage Percentage: 0.0

98[2023-04-24 05:27:30] Code Coverage should be a minimum of 75% but actual value is 0.0% !

Hi,

First, and I don’t know how I overlooked this previously, your version is EOL. You need to upgrade to SonarQube 9.9 LTS at your earliest convenience, and then possibly go on to 10.0, the current version.

Second, I still find the /../ in your path highly suspicious. It’s very strange that the coverage report is generated in a directory next to where the project actually lives. It makes me suspicious of a deeper misconfiguration or structure problem in your project.

And we still need the analysis log.

 
Ann