I am using SonarQube version 6.7 for running analysis of Maven projects using the command mvn clean verify sonar:sonar
from the project directory using command prompt and get the results. The sonar configurations in settings.xml
for maven (v3.5.3) are added respectively.
In Jenkins (version 2.161), I have installed SonarQube Scanner for Jenkins
(v2.8.1) plugin. The SonarQube Server configuration is configured as below.
In the Jenkins
maven project, I have configured the post steps as below.
I have checked the Prepare SonarQube Scanner environment
in the Build Environment
section and the Build goal is -e clean verify sonar:sonar
.
My issue is, when the SonarQube analysis for a maven project is triggered through command prompt using the command mvn clean verify sonar:sonar
, I am getting the results as expected. But when the Jenkins
job is triggered with the configurations above for the same maven project, the results are different and incorrect. What am I missing?
PS- In the Post-build Actions
, I can see the SonarQube analysis with maven
is deprecated.
Thanks in advance.
You use different scanners. First you used SonarScanner for Maven ( mvn sonar:sonar
). Next you used Basi SonarScanner, which requires manual configuration of all options.
The best option to sole it is always use the same scanner. You have Maven project, so you can enable Prepare SonarQube Scanner environment
in Build Environment
, and next execute Sonar goal $SONAR_MAVEN_GOAL
in Build
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.