1、下在zip檔案,直接解壓即可。
然後修改配置檔案
Edit <install_directory>/conf/sonar.properties
參見:http://docs.sonarqube.org/display/SONAR/Installing+the+Server#InstallingtheServer-installingWebServerInstallingtheWebServer
啟動sonar:
進入bin目錄,選擇系統:
cd /opt/sonarqube-5.6/bin/linux-x86-64
sonar.sh start
即可,然後檢視啟動日志 logs/sonar.log
和maven進行內建(推薦):
一、Maven配置
1、 找到 maven_install_path/conf/setting.xml 檔案
在 <profiles>标簽中添加如下配置:
1 2 3 4 5 6 7 8 9 10 11 | |
2、 找到父項目(parent)的pom.xml:
在
<build>
<plugins>
......
</plugins>
</build>
中添加下面這個plugin
1 2 3 4 5 | |
二、運作maven指令,執行代碼掃描
mvn sonar:sonar
三、官方文檔
參見:
http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Maven
和gradle進行內建:
配置gradle.properties
systemProp.sonar.host.url=http://172.16.1.63:9000
激活配置:build.gradle
plugins {
id "org.sonarqube" version "2.0.1"
}
參見:
http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle
和jenkins進行內建:
1、安裝sonarqube plugins
2、配置sonarqube server
3、配置sonar runner
參見:http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins
OK