I can't find how to rename a project in SonarQube 5.1.
Once created, how one can change project name, key, branch, from the web dashboard?
SonarQube's documentation doesn't help.
I can't find how to rename a project in SonarQube 5.1.
Once created, how one can change project name, key, branch, from the web dashboard?
SonarQube's documentation doesn't help.
You need to "update the project key" (I always think that the Sonar terminology here isn't very helpful)
https://docs.sonarqube.org/display/SONAR/Project+Settings#ProjectSettings-UpdatingProjectKey
and then re-run the analysis (with the new project key, so having updated your sonar-project.properties or build.xml or pom.xml, etc)
In SonarQube 5.1 the project name can't be changed from the web dashboard (Probably it will not be possible in the future as well).
I configure my SonarQube projects sonar-project.properties
where I only have to change this line:
sonar.projectName=MyNewProjectName
Rerun the analysis to see the result in the web dashboard.
To change the projet name in UI run this SQL query :
UPDATE sonar.projects
SET name = 'NEW_PROJECT_NAME',
long_name = 'NEW_PROJECT_NAME'
WHERE kee = 'PROJECT_KEY'
If you are using jenkins and your sonar build is a post build step. You may add the property mentioned by @adrianko to your goals.
$SONAR_MAVEN_GOAL -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_AUTH_TOKEN -Dsonar.projectName="YOUR PROJECT NAME"
CREATE PROCEDURE usp_ChangeProjectName
@CaseSensitiveProjectKeyToChange VARCHAR(300),
@NewProjectName VARCHAR(300)
AS
BEGIN
SET NOCOUNT ON;
IF (SELECT COUNT(*) FROM dbo.projects WHERE kee = @CaseSensitiveProjectKeyToChange and scope = 'PRJ') > 1
BEGIN
RAISERROR ('Operation would affect more than one record, cancelling for safety.', 16, 1)
END
UPDATE
dbo.projects
SET
name = @NewProjectName,
long_name = @NewProjectName
WHERE
kee = @CaseSensitiveProjectKeyToChange and
scope = 'PRJ'
END
GO
Sample Usage usp_ChangeProjectName2 '<project key>', '<new name>'