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.
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.
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)
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"
In SonarQube 8.6 (PostgreSQL), execute SQL
UPDATE projects
SET name = 'NEW_PROJECT_NAME'
WHERE kee = 'PROJECT_KEY';
UPDATE components
SET "name" = 'NEW_PROJECT_NAME',
long_name = 'NEW_PROJECT_NAME'
WHERE kee = 'PROJECT_KEY';
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>'
Just add or edit gradle.properties
file as below:
org.gradle.java.home=C\:\\Program Files\\Java\\jdk1.8.0_191
org.gradle.jvmargs=-Xmx1536m
systemProp.sonar.host.url=https://abc.xyz.com
#----- Token generated from an account with 'publish analysis' permission
systemProp.sonar.login=your token goes here
systemProp.sonar.projectName=ProjectName
Please change the path of JDK as per your system configuration, sonarqube server url, access token and finally the name of project that you want to give. By default in android studio project name is app
Just let me know if anybody face any problem while integration of sonarqube.
I tried all the way but it did not work for me . At last my bamboo server gave me some hint . Instead of using projectName pror you can use "/n:" key.. i.e /n:"your project name".
There is no possibility to rename the project in the web frontend (tested with Sonarqube V 9.3).
But you can change the project name by running the sonar scanner commandline interface locally and passing the new project name (also the sonar token and the project key) as parameter (If sonar-scanner is started in the same directory in which sonar-project.properties is located, the properties are also read from this file):
sonar-scanner -Dsonar.projectName="enter_new_projectname_here“ -Dsonar.login="your_sonar_token“ -Dsonar.projectKey="your_project_key“
On macOS the sonar scanner can be installed with homebrew:
brew install sonar-scanner
For other platform see https://github.com/SonarSource/sonar-scanner-cli
In our case, when we changed -Dsonar.projectName
and ran the analysis on developers' branches, nothing changed.
Until we ran analysis on the main (master) branch -> then project name was automatically changed