Need mvn sonar command to avoid new Project creation at every scan

Hello ,

Community EditionVersion 8.3
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

Hello,

The Scanner for Maven is able to simoply infer project Name and project key () from the pom.xml content, that is why it very uncommon to override properties with -Dsonar.projectName and -Dsonar.projectKey like you describe

When you set a different project key at each scan of your code source, it is expected to create a new SonarQube project each time

In order to keep historical scans on a single project, you absolutely need to keep the same static project key (or as mentioned earlier , have the mvn sonar:sonar command automatically create the static project key from the pom.xml content)

If we keep same static project key then mvn is unable to scan.

This is not expected and we would need more details here like the DEBUG logs of this failing scan

Verbose logs are generated with the addition of the -X parameter to your man sonar:sonar command, could you please share them here ?

Eric

Hello Eric,

Thanks for the reponse.

We are trying with -X option and will share the logs.

However we have 60+ projects with same name and different key in Sonarqube console. Is there any way to merge the existing project?

Thanks and Regards,
Ishwari

Hello,

The mvn command is working as expected.

We have existing 60 projects with different keys and same project name. Is there any way to merge them ??
We need to merge all the project as one single project.

Thanks and Regards,
Ishwari