问题
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.
回答1:
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)
回答2:
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.
回答3:
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"
回答4:
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'
回答5:
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>'
回答6:
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.
来源:https://stackoverflow.com/questions/30511849/how-to-rename-a-project-in-sonarqube-5-1