- 服务器环境:
Sonarqube:7.0
Maven: 3.5.2
Suse11
Mysql5.6(必须>=5.6)
- 添加sonarUser用户及用户组
1) useradd sonarUser
2) passwd sonarUser
3) groupadd sonarUser
4) usermod -g sonarUser sonarUser
解压到/usr/local/sonarqube-7.0下
- 修改配置:conf/sonar.properties 指定本地数据库:
sonar.jdbc.username=root
sonar.jdbc.password=root
#----- Embedded Database (default)
# H2 embedded database server listening port, defaults to 9092
#sonar.embeddedDatabase.port=9092
#----- MySQL 5.6 or greater
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported. It can not be changed.
sonar.jdbc.url=jdbc:mysql://10.110.1.65:3306/sonar7?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
- 修改sonar的目录和用户组为sonarUser
chown -R sonarUser:root sonarqube-7.0
- 切换到sonarUser
su sonarUser
- 启动SonarQube:bin/linux-x86-64/sonar.sh start
浏览器打开http://10.102.16.91:9000即可使用
默认用户名密码:admin/admin
================================== 普通打包命令
mvn clean package -Dmaven.test.skip=true
mvn clean deploy
======================================sonar校验
mvn clean package -Dmaven.test.skip=true sonar:sonar -Dsonar.host.url=http://10.102.16.91:9000 -Dsonar.login=fc38e154d6fce5c9dd6f773f5b796c86ff25ea7e -Dsonar.branch=jfire
mvn clean package -Dmaven.test.skip=true sonar:sonar -Dsonar.login=fc38e154d6fce5c9dd6f773f5b796c86ff25ea7e -Dsonar.branch=lctime_v2
mvn clean package -Dmaven.test.skip=true sonar:sonar -Dsonar.host.url=http://10.102.16.91:9000 -Dsonar.login=fc38e154d6fce5c9dd6f773f5b796c86ff25ea7e -Dsonar.branch=storm-api
mvn clean package -Dmaven.test.skip=true sonar:sonar -Dsonar.host.url=http://10.102.16.91:9000 -Dsonar.login=fc38e154d6fce5c9dd6f773f5b796c86ff25ea7e -Dsonar.branch=wmcontent
mvn clean package -Dmaven.test.skip=true sonar:sonar -Dsonar.host.url=http://10.102.16.91:9000 -Dsonar.login=fc38e154d6fce5c9dd6f773f5b796c86ff25ea7e -Dsonar.branch=licaishi
==================================支持覆盖率
mvn org.jacoco:jacoco-maven-plugin:prepare-agent clean install -Dmaven.test.skip=true sonar:sonar -Dsonar.login=fc38e154d6fce5c9dd6f773f5b796c86ff25ea7e -Dsonar.branch=lctime_v2
mvn org.jacoco:jacoco-maven-plugin:prepare-agent clean install sonar:sonar -Dsonar.login=fc38e154d6fce5c9dd6f773f5b796c86ff25ea7e -Dsonar.branch=wmcontent_20171221
75003AAF4722057d5090e3008a65a288