sonar自动化测试四:SonarScanner使用

Laughing
2021-04-30 / 0 评论 / 1,091 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2024年03月18日,已超过346天没有更新,若内容或图片失效,请留言反馈。

创建配置文件

进入到待测试的项目根目录,新建sonar-project.properties文件:
输入命令vi sonar-project.properties,进行文本编辑模式。
增加如下配置,其中:sonar.projectName是项目名字,sonar.sources是源文件所在的目录

# must be unique in a given SonarQube instance
sonar.projectKey=my:intelligence-operations-system
# this is the name displayed in the SonarQube UI
sonar.projectName= intelligence-operations-system
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/main/java
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
#path to your project build output path
sonar.java.binaries=target/classes

使用

打开终端,进入待测试项目根目录,执行命令:

sonar-scanner

查看后台任务

打开SonarQube,在浏览器打开http://localhost:9000,即可看见正在分析中的后台任务

1

评论 (0)

取消
  1. 头像
    武林盟主
    MacOS · Safari

    很好啊,感谢

    回复