0
votes

I tried running a sonar analysis using a java project on Jenkins using the standard maven sonar:sonar goal and also using the post step>> Execute SonarQube scanner. The maven goal I used is.

clean org.jacoco:jacoco-maven-plugin:0.7.8:prepare-agent package org.jacoco:jacoco-maven-plugin:0.7.8:report sonar:sonar -Dmaven.test.failure.ignore=true

For SonarQube scanner I used the below maven goal

clean org.jacoco:jacoco-maven-plugin:0.7.8:prepare-agent package org.jacoco:jacoco-maven-plugin:0.7.8:report -Dmaven.test.failure.ignore=true

and in the Post step, I added Execute SonarQube scanner step.

Using maven sonar:sonar goal, I got 60% coverage and using the post step, I got only 49%. Not able to figure out the reason for the difference.

SonarQube version - 7.7 Sonar Scanner version - 3.3.0 Jenkins version - 2.164.3 Maven version - 3.6.1

1
You should pose that question to the SourceSource Community (or see if there's an answer there) : community.sonarsource.com/c/help/sq Curious what they sayIan W
Will try that. I have seen people from sonarsource team responding here on SO questions earlier.Upen

1 Answers

0
votes

I had mentioned sonar source directory different for both the runs. For maven, it was picked from pom.xml where it was src/main and for sonar scanner it was configured in the job as src. After changing it, the issue got resolved.