I am 8.2 developer edition and using Jenkins to run the SonarScanner for MSBuild 4.9 on a dotnet framework project. However despite passing the project key in as a parameter it is still creating a new project in SonarQube based on the branch name. So for each branch I get a new project.
The code being used is:
bat "SonarScanner.MSBuild.exe begin /k:\"${sonarprojectkey}\" "
bat "\"${tool 'msbuildhome'}\\MSBuild.exe\" \"${env.WORKSPACE}\" /t:Rebuild"
bat "SonarScanner.MSBuild.exe end"
}
Is there somewhere else I should be passing the project key?
I have enabled verbose logging and found that the .sonarqube\out\.sonar\mod2 folder.
When I navigate to this folder I can see in the sonar-project.properties file there are two entries for sonar.projectKey=.
The one at the top is the correct value I pass I the switch parameter but the last one is the branch name.
Is this a bug or I am missing a configuration somewhere?
Apologies, another Jenkins admin had set the âAdditional Analysis Propertiesâ to be the job name and didnât tell anyone. This was easily fixed but it is worth sharing the project key can be overridden in Jenkins.