4
votes

Recently I upgraded sonarqube from 4.0 to 4.3.3. Post upgrade when I try to run the maven build I am getting the error:

Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project xxx on project yyy Module "abc.def.xyz" is already part of project of other project.

The issue is we scan on multiple branches so we will have modules with the same name.
Is there a way to turn off this validation?

1
There's no way to turn this validation off, this is a sanity check. If you're analysing branches with the "sonar.branch" property, this should not be a problem and it should work. So if you get this error, this means you're doing something wrong somewhere. - Fabrice - SonarSource Team

1 Answers

1
votes

Assume you have multiple modules Maven project with below structure:

com.company:project
    com.company:project-module1
    com.company:project-module2

In your java source code, now "com.company:project" renamed to "com.company:myProject", so new java source strucutre becomes:

com.company:myProject
    com.company:project-module1
    com.company:project-module2

When you build new source and push analysis data to Sonar, it prompt:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project myProject: Module "com.company:project-module1" is already part of project "com.company:project" -> [Help 1]

This error is because the "com.company:project-module1" already executed and registered into Sonar before and now it belongs to "com.company:project" project whihc no longer exist in your source code anymore.

Solution: In Sonar project configuration --> Update key, change the project "com.company:project" key from "com.company:project" to "com.company:myProject", rerun Maven build and push to Sonar, issue will solve.