代码质量管理平台SonarQube的安装、配置与使用

原文地址:https://www.cnblogs.com/qiumingcheng/p/7253917.html

主要记录下遇到问题的地方:

1、下载地址:

sonarqube:http://www.sonarqube.org/downloads/

Scanner:https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.0.3.778-windows.zip

可能是原文中的Scanner版本过低,项目中采用的是jdk版本为 1.8.0_66

2、sonarqube的登录名和密码默认为admin

3、本地汉化没有安装,不过不影响使用

4、打开Sonar Scanner根目录下的/conf/sonar-scanner.properties文件,配置如下:

mysql节点下输入以下信息

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqubetest?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.jdbc.username=root
sonar.jdbc.password=root
 sonar.host.url=http://localhost:9000 //sonar.host.url配置的是SonarQube服务器的地址,如果测试项目与服务器不在同一台机子,则需要添加服务器的IP
5、 打开要进行代码分析的项目根目录,新建sonar-project.properties文件,配置如下:

# must be unique in a given SonarQube instance
sonar.projectKey=myProject
# this is the name displayed in the SonarQube UI
sonar.projectName=projectName
sonar.projectVersion=1.0
 
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set. 
# If not set, SonarQube starts looking for source code from the directory containing 
# the sonar-project.properties file.
sonar.sources=src
sonar.java.binaries=target
 
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
注意:sonar.java.binaries=target 为项目编译后的class文件存放地址

6、设置完后,打开cmd面板,进入项目根目录下,然后输入“sonar-scanner”命令,执行代码分析







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值