which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) SonarQube -7.9.1, sonar-scanner-4.0.0.1744-windows, Sonarqube + SonarScaner plugin for jenkins.
what are you trying to achieve. I want to get result from different jenkins buld-jobs in to different SonarQube projects.
what have you tried so far to achieve this. Configurate Sonar Scaner and Sonar qube configs. Created 3 projects in SonarQube server.
Problem: I have some different applications and want to separate code review results into different Sonar Project but after i do all config setups it always goes to 1.
First project jenkins Analysis properties
#Required metadata
Sonar.ProjectKey=AAA
Sonar.ProjectName=AAA
Sonar.ProjectVersion=1.0
# path to source directories
sonar.sources=D:/JenkinsJobWorkspaces/AAA60-Build-Git/workspace
Second project jenkins Analysis properties #Required metadata
Sonar.ProjectKey=BBB
Sonar.ProjectName=BBB
Sonar.ProjectVersion=1.0
sonar-scanner
#----- Default SonarQube server
#sonar.host.url=http://localhost:9000
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8
How shall i change properties to get results from Jenkins AAA job into SonarQube AAA project and BBB to BBB and those wont be over writed by others if i decide to create CCC and etc.
sonar.projectKey=AAA
sonar.projectName=AAA
sonar.projectVersion=1.0
sonar.sources=.
if every Jenkins job uses a unique sonar.projectKey there should be three Sonarqube projects.
Do you use (multibranch)pipeline or classic jobs ?
Is this a maven, gradle, npm … build ?
Does the Jenkins user have full admin rights in Sonarqube | Do you use sufficient credentials
in the Sonarqube stage in all Jenkins jobs ? admin rights are needed for project creation.
You should see something in the logs, if not.
Is it possible to share the Sonarqube related parts of the Jenkins job console log ?
Hello,
All tools work fine, but i can’t split review into different projects.
I started from 1 project i named it AAA. He have this Analysis properties in Jenkins. #Required metadata
Sonar.ProjectKey=AAA
Sonar.ProjectName=AAA
Sonar.ProjectVersion=1.0
Then i run job it sucessefully store code review into Sonar project AAA. But i decide to create another project named it BBB and set Analysis properties in Jenkins. #Required metadata
Sonar.ProjectKey=BBB
Sonar.ProjectName=BBB
Sonar.ProjectVersion=1.0
After i run job it stores review into AAA project and overwrite old code review.
All good with credentials(i use secret text for Auth token) and mark Enable injection of SonarQube server configuration as build environment variables.
All works but i can’t split this two into dif projects.
Maybe i need to change sonar-scanner.properties because i think he take project key from it and of course it AAA how shall i write properties for multiple projects for sonar scanner or there is other way or reason why it dont go to right place?
So i found the way to split review in different project.
You must create sonar-project.properties file for every jenkins job. with project key parameter.