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

52

我对SonarQube的接触很少,但被要求制作一份文件,说明如何设置/使用“sonar-project.properties文件”。非常感谢任何信息或输入。

2个回答

30

9
第一个链接现在已经过时了,第二个链接也不是很详细。虽然这个链接有些老,但内容更丰富,可以提供更多信息:https://www.devopsschool.com/tutorial/sonarqube/sonarqube-properties.html。 - Ed Graham
3
第二个链接看起来非常正式,但已经失效了。请注意,Sonar实际上建议使用GUI而不是.properties进行配置:https://community.sonarsource.com/t/do-sonarsource-prefer-the-use-of-web-ui-for-project-configuration-if-yes-why/26529 - julaine

14
在项目的根目录中创建一个配置文件:
  • 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

参考资料:


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接