部署环境 windows jdk8
1.https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.8.zip
下载之后不需要任何配置就可以启动但是不是完全体
2配置mysql
在配置文件配置mysql配置
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
sonar.jdbc.username=root
sonar.jdbc.password=123456
sonar.sorceEncoding=UTF-8
sonar.login=admin
sonar.password=admin
注意末尾不能有空格
3.重启bat 如果报错文件被占用请杀掉java进程。
这样带数据库的软件就安装成功了
修改sonar-scanner.properties
sonar.host.url=http://localhost:9000
sonar.sourceEncoding=UTF-8
注意这个软件需要配置环境变量测试命令 sonar-scanner -h
5.使用
进入待检测项目的根目录中,新建sonar-project.properties文件,文件内容为:
# must be unique in a given SonarQube instance
sonar.projectKey=ner_predict_model # 修改为自己的
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=ner_predict_model # 修改为自己的
sonar.projectVersion=1.0 # 修改为自己的
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
打开DOS窗口,切换目录到项目目录,输入sonar-scanner
运行成功后,打开web界面,即可看到对当前项目的分析。
中文插件等插件自己研究吧