I have a small OS tool project using a multi-module Maven build.
I added the sonar.properties and now try to run the analysis from Github Actions (also tried locally with same result), but I always get an error during Sonar analysis
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project upm-client: Project ‘cbromberg_upm-client’ can’t have 2 modules with the following key: cbromberg_upm-client -> [Help 1]
First, because you have a Maven project to scan, you don’t need at all a sonar-project.properties. You should remove it.
Here what I did on my side for your project. I forked it here https://github.com/agigleux/upm-client, then I switched to SonarCloud and declared it (click on the top right on the + icon “Analyze new project”). I selected my organization called “agigleux”, then the project “upm-client”. The tutorial is telling me SonarCloud can’t scan it (because it’s made of 100% of Java), so I have to trigger the scan from my CI or locally. I selected manually to get the details about the “sonar.projectKey” and “sonar.organization”
I cloned the project locally to validate it’s working fine and then I run:
Thanks a lot - the problem was that I had copied the sonar.projectKey into my pom.xml and it seems that this caused the maven sonar analyser to use the same projectKey for every module.
Maybe you should change the getting started guide then, because it suggests to do exactly that: