How to use multiple properties files

Hello!
I’m new to Sonarqube and am attempting to use scanner with multiple properties files. The goal is to specify a property that is specific to a particular project. For example I wish to point the sonar.sources parameter to a different location in each sonar-scanner.properties file. I am attempting to launch the scanner from the DOS command line. Unfortunately, it seems that scanner still uses the default properties file in the /conf directory.

ex. sonar-scanner -X -Dsonar.projectKey=TestAutomation -Dsonar.projectName=TestAutomation -Dproject.settings=sonar-scanner.myFile.properties

Is it possible to utilize scanner in this manner? Thanks!

Hi,

Welcome to the community!

You should place a sonar-project.properties file in the root of each project and configure project-specific values such as sonar.sources only in these project-specific files and not in the scanner’s root configuration file.

Passing values on the analysis command line, as you have demonstrated, is another option. And even with that, you shouldn’t configure project-specific values such as sonar.sources in the root scanner configuration file.

 
HTH,
Ann