I am using 9.2.3 version of SonarQube Community Edition and scanned some of the projects with sonar-scanner and created the project from it. I want to perform the scan of the same repository and want to change the name of the repository from remotely with Sonar-Scanner and don’t want to create the new project with the new name and instead change the existing project name.
The Project Key (the unique identifier for each project) can be adjusted in the project-level Administration > Update Key – that new project key will have to be used anywhere the old project key was used. You still have to update sonar.projectName at analysis time to change the project name (the display name, just for vanity!)
The project key has to be changed from the UI as you stated.
Then from the CI tool ex Jenkins, you need to pass the -Dsonar.projectKey=new projectkey -D sonar.projectName=new project name which changes the old project name to new project name as you updated the key via UI and passing new project name from CLI?
My understanding is right?
Can’t override the key as well remotely? because I am getting the project key and project name dynamically from somewhere in code. if we can change it from remote would be helpful for me, will ease my work
Ultimately – SonarQube has to be aware of the changed key so that it makes the connection when the scanner is run… SonarQube can’t guess that the key was changed. So it needs to be updated in SonarQube.
no, the project name can only be changed via analysis property sonar.projectName
or via direct change in the Sonarqube database - which is not recommended, you should
treat it as black box.
I used the DB edit one time for a bulk change after reorganisation where i had to change a LOT of
Sonarqube project names at once.
Lets say I had a project name and key as PORTAL_COMPONENT, and since we are building different versions together now i have changed project name and key to PORTAL__COMPONENT. (version value is dynamically added from jenkins).
Now the issue comes that with the new project name i am getting increased issue count than the old one. If i revert the naming change, then its fine again… not getting how this coming.