Jenkins sonar
参考
http://www.cnblogs.com/wjoyxt/p/5702406.html
http://newthink.blog.51cto.com/872263/1863334
https://zhuanlan.zhihu.com/p/22926742
https://my.oschina.net/sanping/blog/345653
https://docs.sonarqube.org/display/SONAR/Documentation/
ENV
Jenkins:172.20.20.90 数据库:172.20.20.11
sonarquebe
与 sonar-scanner
安装在Jenkins
上
sonarqube
sonarqube-6.2
https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.2.zip
执行
/usr/local/sonarqube-6.2/bin/linux-x86-64/sonar.sh start
启动服务 ,访问地址:IP:9000
配置数据库
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'sonar' IDENTIFIED BY 'sonar'; GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar'; GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar'; FLUSH PRIVILEGES;
重启服务
/usr/local/sonarqube-6.2/bin/linux-x86-64/sonar.sh retart
sonar-scanner
sonar-scanner-2.8
wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-2.8.zip
修改 /usr/local/sonar-scanner-2.8/conf/sonar-scanner.properties
sonar.host.url=http://172.20.20.90:9000
sonar.sourceEncoding=UTF-8
环境变量
## sonar-scanner export PATH=/usr/local/sonar-scanner-2.8/bin:$PATH
Jenkins
安装插件 SonarQube Plugin
系统设置
Server authentication token
在sonar web界面设置:我的账户 ==> 安全 ==> 拷贝
加密信息
Global Tool Configuration
Maven 项目配置
sonar-project.properties
sonar.projectKey=cooperate-sit-account sonar.projectName=cooperate-sit-account sonar.projectVersion=1.0 sonar.sources=account-resources sonar.sourceEncoding=UTF-8 sonar.language=java
sonar.sources
根目录在 /root/.jenkins/workspace/cooperate-sit-account/