主要sonar安装在另一篇
https://blog.csdn.net/jiulanhao/article/details/105835247
sonar-scanner的下载地址
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/
这里我选择4.3版本,sonarweb 是7.7
1.进入conf目录下进行配置文件的配置
#Configure here general information about the environment, such as SonarQube server connection details for example
#No information about specific project should appear here
#----- Default SonarQube server
sonar.host.url=http://localhost:9000
#配置web端的地址
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8
2. 配置完成后将bin下的sonar-scanner.bat设置为环境变量,以供在任何目录下使用。
3.选择要扫描的项目,进入该项目的根目录使用以下命令
sonar-scanner.bat -D"sonar.projectKey