Need mvn sonar command to avoid new project creation at every Scan | mvn -Dsonar.projectName=ProPR-Project -Dsonar.projectKey=“ProPR-Project-${Revision_Number}”

We are using below command to enable maven Sonar scan

"mvn -Dsonar.projectName=ProPR-Project -Dsonar.projectKey=“ProPR-Project-${Revision_Number}” --file parent/pom.xml sonar:sonar "

We have same project name but Project key changes as per revision number.

Issue here is 1) Even though project name is same, Every time new Project is created in SonarQube
2) If we keep same static project key then mvn is unable to scan.

Need some command to have scan reports appended in same project
Please help

Hi.

The sonar.projectName property is just a description. SonarQube is creating new projects because your using a different sonar.projectKey each time.

What’s the exception message?

Hello,
Thank you for the quick response.

Currently I am using

mvn -Dsonar.projectName=ProPR-Project -Dsonar.projectKey=“ProPR-Project-${Revision_Number}” --file parent/pom.xml sonar:sonar

This everytime creates a new Project named - “ProPR-Project” with new key .

Also if we use
mvn -Dsonar.projectName=ProPR-Project -Dsonar.projectKey=“ProPR-Project” --file parent/pom.xml sonar:sonar

Sonar run fails.

We need command such that…
Only one project “ProPR-Project” must be created. In that same project further scan report must be added.