我如何使用或设置sonar-project.properties文件

Cha*_*vin 14 properties-file sonar-runner sonarqube

我很少接触到SonarQube但都被要求做一个文件,解释如何设置/使用"sonar-project.properties文件".任何信息或输入将不胜感激.

ℛɑƒ*_*ƒæĿ 15

在项目根目录下创建配置文件:

  • sonar-project.properties
# Must be unique in a given SonarQube instance
sonar.projectKey=my-project

# This is the name and version displayed in the SonarQube UI.
# Was mandatory prior to SonarQube 6.1.
sonar.projectName=My project
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=src
 
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
Run Code Online (Sandbox Code Playgroud)

参考:


Tec*_*dle 13

这里有一些资源可以帮助您入门

https://www.wrightfully.com/setting-up-sonar-analysis-for-c-projects/ - 请参阅步骤6:sonar-project.properties文件.

https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

github上也有一些示例项目,您也可以参考project.properties文件, https://github.com/SonarSource/sonar-scanning-examples

  • 第一个链接现在已经过时了,第二个链接也不是很详细。这虽然很旧,但信息更丰富:https://www.devopsschool.com/tutorial/sonarqube/sonarqube-properties.html。 (9认同)
  • 第二个链接虽然看起来非常官方,但已失效。请注意,声纳实际上建议使用 gui 而不是 .properties 进行配置:https://community.sonarsource.com/t/do-sonarsource-prefer-the-use-of-web-ui-for-project-configuration-如果-是-为什么/26529 (3认同)