工具

Sonar6.2 安装使用指南

Sonar6.2 安装使用指南
sonar
Answer
2/22/17 2:54 AM
# 服务器信息
临时借用备用机 10.203.96.60  wlsadmin/Pass1234
安装目录 /midware/sonarqube-6.2
 
# 安装
安装文件备份:covapp@10.203.25.128:/home/covapp/software_bundles/sonarqube-6.2.zip
当前版本需要JDK1.8支持,MySQL5.6以上版本
 
安装步骤:
1. 解压缩 unzip sonarqube-6.2.zip
2. 修改配置文件 conf/sonar.properties
sonar.jdbc.url=jdbc:mysql://10.203.96.101:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar1!Q
sonar.web.port=8099
sonar.web.context=/sonar
sonar.web.javaOpts=sonar.web.javaOpts=-server -Xmx2048m -Xms512m -XX:+HeapDumpOnOutOfMemoryError
3. 修改配置文件 conf/wrapper.conf
wrapper.java.command=/midware/jdk1.8.0_121/bin/java
 
 
# 启停命令
 
bin/<os type>/sonar.sh start/stop/restart
 
# 管理页面
 
 
默认管理员:admin/admin
 
TBD
 
 
# Sonar Scanner
 
 
Windows环境使用方法:
1. 下载 SonarQube Scanner 2.8
2. 解压缩
3. 修改 conf/sonar-scanner.properties
sonar.host.url=http://10.203.96.60:8099/sonar
4. 在待扫描项目根目录创建 sonar-project.properties
# must be unique in a given SonarQube instance
sonar.projectKey=sgm:msb
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=MSB
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=.
 
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
5. 打开CMD窗口,切换到带扫描项目根目录,执行 sonar-scanner.bat (使用全路径或者配置path环境变量)
 
如上,使用 sonar scanner 时不需要提前在 sonarqube 管理页面创建项目。
0 (0 Votes)