本文档使用版本
https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.7.4.zip
https://docs.sonarqube.org/display/SONARQUBE67/Documentation
与mvn集成
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Maven
mvn sonar:sonar \
-Dsonar.host.url=http://sonarQuebe-ip:9000 \
-Dsonar.login=your_token
与gradle集成
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle
plugins {
id "org.sonarqube" version "2.5"
}
./gradlew sonarqube \
-Dsonar.host.url=http://sonarQuebe-ip:9000 \
-Dsonar.login=your_token
中文插件
https://github.com/SonarQubeCommunity/sonar-l10n-zh
ldap集成
https://docs.sonarqube.org/display/SONAR/LDAP+Integration
访问运用市场安装 http://sonarQuebe-url/admin/marketplace?search=ldap
#LDAP Support
sonar.security.realm=LDAP
ldap.url=ldap://ldap-ip:389
#禁止密码访问情况下,需要设置DN(即管理账号)
ldap.bindDn=
ldap.bindPassword=
# User Configuration
ldap.user.baseDn=ou=People,dc=xxx,dc=xxx
ldap.user.request=(uid={login})
ldap.user.realNameAttribute=cn
ldap.user.emailAttribute=email
# Group Configuration
ldap.group.baseDn=ou=Group,dc=xxx,dc=xxx
ldap.group.request=(memberUid={uid})
sonar-scanner-cli
https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/
jenkins集成
step1. 安装jenkins插件 [SonarQube Scanner for Jenkins](http://redirect.sonarsource.com/plugins/jenkins.html)
step2. jenkins全局配置
step3. jenkins pipeline
stage('Sonar') {
sh 'mvn sonar:sonar -Dmaven.test.skip=true'
}
网友评论