0

I would like to maintain one generic properties file to, for example, contain the SonarQube login information. Each specific project would then have its own properties file. Is there a way to accomplish this? It seems that only one properties file is recognized.

I am running SonarQube v5.6.6

Thanks in advance.

SteveK
  • 101
  • 2
  • 10
  • Why do you want to do this? You could create a small program that creates the properties file for you just before scanning. – Jeroen Heier Aug 18 '17 at 03:49
  • The main reason I'd like the flexibility of maintaining a generic properties file is to keep the login separate. The other settings should be applicable to everyone and will be maintained in our version control system (Git). Generating a properties file at build time is manageable, but, if a mechanism already exists to support multiple properties files, that would be cleaner. – SteveK Aug 21 '17 at 14:33

1 Answers1

0

Per Scanner for MSBuild documentation :

  • you can add login information under the Scanner installation directory (hence common to all projects), @ scanner_install_dir\bin\SonarQube.Analysis.xml
  • project specific properties can then be passed via command line when executing the scanner
  • for very special cases (rarely needed), you can also set Additional Analysis Parameters
Nicolas B.
  • 7,245
  • 17
  • 29
  • My SonarQube.Scanner.MSBuild.exe is installed in the directory C:\SonarQube\Scanners\sonar-scanner-msbuild-3.0.0.629SonarQube.Analysis.xml – SteveK Aug 18 '17 at 21:36
  • My SonarQube.Scanner.MSBuild.exe is installed in the directory C:\SonarQube\Scanners\sonar-scanner-msbuild-3.0.0.629 I modified the SonarQube.Analysis.xml in that directory to contain the login information. That worked fine until I added /s:C:\Temp\Project.Properties.xml to the command line. The Project.Properties.xml only contained: true But that was enough to cause the scanner to ignore the SonarQube.Analysis.xml file and the login failed. – SteveK Aug 18 '17 at 21:43
  • @SteveK Use the /d option. See the last line in [Additional Analysis Parameters](https://docs.sonarqube.org/display/SCAN/Additional+Analysis+Parameters) – Jeroen Heier Aug 22 '17 at 03:57
  • @JeroenHeier, I was hoping to avoid using the /d option for passing login information because the command line is visible in the build logs. Since it seems that I am unable to use multiple properties files though, I will probably need to resort to using the /D. BTW. We have too many properties to try to pass most of them to SonarQube.Scanner.MSBuild via the command line, so the bulk of them need to be in a properties file. – SteveK Aug 22 '17 at 21:08