Construction of jenkins+sonarQube automated analysis platform
1. Jenkins installation
omitted here, you can refer to
http://download.csdn.net/download/yixibo23921552/10189424
2. SonarQube installation
Go to https://www.sonarqube.org/downloads/ to download, find the corresponding version, pay attention to the corresponding jdk version, after downloading, extract it to the system directory to /opt/java/sonar/sonarqube-5.6.6
3. SonarQube plugin installation
Log in to jenkins, enter system management , select plug-in management,
Search SonarQube Scanner for Jenkins , find the corresponding plug-in, download and install it automatically
After restarting Jenkins , log in with administrator privileges: System Management --> Global Tool Configuration ; the following two global configuration items are added: SonarQubeScanner for MSBuild , SonarQube Scanner . /opt/java/sonar/sonarqube-5.6.6
Configure SonarQube Scanner , the Name item can be customized, and the SONAR_RUNNER_HOME item fills in the installation path of SonarQube Scanner .
Then enter the system system management , system settings
4, sonarQube Scaner configuration
Create a new release in jenkins, if the project name is used, analysis_System
In Execute SonarQube Scanner execution
written shell script
#required metadata
sonar.projectKey=system
sonar.projectName=system
sonar.projectVersion=1.0.1
#sonar.sourceEncoding=UTF-8
sonar.modules=java-module,jsp-module,javascript-module,html-module,css-module
# Java module
java-module.sonar.projectName=system_java
java-module.sonar.language=java
sonar.sources=/root/.jenkins/workspace/analysis_System/src/main
sonar.java.binaries=/root/.jenkins/workspace/analysis_System/target/classes
java-module.sonar.projectBaseDir=.
# JSP module
jsp-module.sonar.projectName=system_jsp
jsp-module.sonar.language=jsp
jsp-module.sonar.sources=/root/.jenkins/workspace/analysis_System/src/main/webapp/webpage
jsp-module.sonar.projectBaseDir=.
# JavaScript module
javascript-module.sonar.projectName=system_js
javascript-module.sonar.language=js
javascript-module.sonar.sources=/root/.jenkins/workspace/analysis_System/src/main/webapp/webpage
javascript-module.sonar.projectBaseDir=.
# Html module
html-module.sonar.projectName=system_html
html-module.sonar.language=web
html-module.sonar.sources=/root/.jenkins/workspace/analysis_System/src/main/webapp/webpage
html-module.sonar.projectBaseDir=.
# CSS module
css-module.sonar.projectName=system_css
css-module.sonar.language=css
css-module.sonar.sources=/root/.jenkins/workspace/analysis_System/src/main/webapp/webpage
css-module.sonar.projectBaseDir=.
After the configuration is saved, come back to the list
Click the Build button, after the build is complete
Enter in the address bar: http://ip:9000/overview?id=system