what is the difference between projectkey/projectname in sonar properties?

1,921 views
Skip to first unread message

jsake...@gmail.com

unread,
May 2, 2018, 1:07:43 PM5/2/18
to SonarQube
Hi All,

My company's sonarqube version is 6.1. We don't have any plans to upgrade now. We are currently using same name for project-key and project-name.

Languages: Java/JavaScript.

We dont want to use same name for both project key and name, but we are confused how to manage the key and name. I found in some places that they use group id for key and artifact id for name. But am not getting a perfect answer for this.

we have maven based projects. But we wont want use sonar plugin in maven pom. we want to use sonar scanner command line parameters and run the scans.

ex:
sonar-scanner -Dproject.settings=${javaCodeQualityProperty} -Dsonar.projectBaseDir=./ -Dsonar.java.libraries=${sonarMavenRepo} -Dsonar.java.test.libraries=${sonarMavenRepo}  -Dsonar.projectVersion="+ mavenVersion + "_java_" + env.BUILD_NUMBER.

sonar-project.properties file:
sonar.projectKey=xyz-JAVA
sonar.projectName=xyz-JAVA
sonar.sources=.
sonar.sourceEncoding=UTF-8

Can someone suggest what is the best approach ?
should we add groupd-id in keyname/branch name or both combined?








Julien HENRY

unread,
May 3, 2018, 6:47:32 AM5/3/18
to SonarQube
Hi,

Project key is a unique identifier for your project, that can be used in most web services for example.
Project name is just a label that will be displayed in SonarQube UI.

The key generation strategy of the scanner for Maven is to concatenate <groupId>:<artifactId> to ensure unicity.

As a side note, be careful about performance issue when using:
-Dsonar.java.libraries=${sonarMavenRepo}

++

Julien

jsake...@gmail.com

unread,
May 3, 2018, 11:16:55 AM5/3/18
to SonarQube
what are the advantages/dis-advantages of using the below approach.

Project Name = {artifact-id} (group-id) {branch_name}
Project Key = {group-id}:{artifact-id}:{branch_name}
Reply all
Reply to author
Forward
0 new messages