Where to store sonar.project.properties in for a single Jenkins project

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
    set sonar.project.properties for a single Jenkins pipeline project
  • what have you tried so far to achieve this
    I was able to set the sonar.projectKey in this location for Jenkins hudson.plugins.sonar.SonarRunnerInstallation/SonarQubeScanner/conf, but what if I have multiple pipeline projects using a sonar scanner. They would each need their own sonar.project.properties file, correct?

Where should I store a unique sonar.project.properties
file in Jenkins?


it depends, does your jenkins pipeline run a maven / gradle / npm … build ?
btw, the settings in $SonarQubeScanner_HOME/conf should be left alone.
Jenkins even provides the option to install the scanner for you, no need to touch the scanner.properties
When runnning the Sonarqube scanner in your Jenkins pipeline you go with

withSonarQubeEnv('sonarfoo') { ... }

When using the generic Sonarqube CLI scanner you need sonar-project.properties available in
project root, means the current working dir of the scanner.
The Sonarqube maven plugin uses sane defaults, if needed you set properties via <properties/>
section in pom.xml or via cli parameters, i.e. -Dsonar.projectKey=com.foo.bar:foobar

see the specifics here https://docs.sonarqube.org/latest/ and choose ‘Scanners’ as category
with all its subentries, i.e https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-maven/
Note that you’re not bound to use the Sonarqube gradle plugin for a gradle build, most of our gradle builds use the generic Sonarqube CLI scanner - whereas that doesn’t make much sense with maven.