Charles.savin
Charles.savin

Reputation: 661

How do I use, or set up sonar-project.properties file?

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.

Upvotes: 65

Views: 213643

Answers (2)

ℛɑƒæĿᴿᴹᴿ
ℛɑƒæĿᴿᴹᴿ

Reputation: 5326

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:

Upvotes: 24

Techtwaddle
Techtwaddle

Reputation: 1711

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

Upvotes: 34

Related Questions