I have very little exposure to SonarQube but have been asked to make a document explaining how to set up / use "sonar-project.properties file". Any information or input would be greatly appreciated.
Asked
Active
Viewed 1.5e+01k times
2 Answers
29
Here are some resources to get you started
https://www.wrightfully.com/setting-up-sonar-analysis-for-c-projects/ - See Step 6: The sonar-project.properties file.
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
There are also some sample projects on github, you can refer to the project.properties files there as well, https://github.com/SonarSource/sonar-scanning-examples

Techtwaddle
- 1,643
- 1
- 15
- 11
-
9The first link is quite out of date now, and the second one is not very detailed. This, although old, is more informative: https://www.devopsschool.com/tutorial/sonarqube/sonarqube-properties.html. – Ed Graham Jan 15 '21 at 16:01
-
2The second link, even though it looks very official, is dead. Note that sonar actually recommends using the gui and not the .properties for configuration: https://community.sonarsource.com/t/do-sonarsource-prefer-the-use-of-web-ui-for-project-configuration-if-yes-why/26529 – julaine Oct 20 '22 at 10:21
12
Create a configuration file in the root directory of the project:
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
Reference:

ℛɑƒæĿᴿᴹᴿ
- 4,983
- 4
- 38
- 58