Integrate Jenkins with Sonar

Please indicate the source for the original reprint: http://agilestyle.iteye.com/blog/2356314

 

Prerequisite

Jenkins has been downloaded and installed by default (Windows and Linux installations are similar, so I won't go into details here)

Git, JDK, Maven in Jenkins have been configured


 

 

Integration Steps

Install the SonarQube plugin


Note:

SonarQube has been installed here, so in the Installed interface

 

Download Sonar

https://www.sonarqube.org/downloads/


Note:

After downloading, start Sonar, http://localhost:9000/account/security, default login account/password: admin/admin, generate token


 

 

Download SonarQube Scanner

https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner


 

Configure SonarQube servers in configure

 

Configure SonarQube Scanner in Global Tool Configuration

Configure Build in project configure - Execute SonarQube Scanner

#require metadata
sonar.projectKey=PetClinic
sonar.projectName=PetClinic
sonar.projectVersion=1.0

#Path to source directory
sonar.sources=F:/Program Files/Jenkins/workspace/$JOB_NAME/src


 

After save, build

Note:

Before building, remember to turn off Proxy to avoid some inexplicable errors, and I don't know why 

 

After the build is successful, view the Detail of SonarQube


 

View the Dashboard information of the project in Jenkins

 

 

Reference

https://jenkins.io/

https://www.sonarqube.org/downloads/

https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

https://docs.sonarqube.org/display/SONAR/Analysis+Parameters

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326669671&siteId=291194637