Maven Advanced Reactor Options with a broken tree of modules

Greeting All,
After recently upgrading to sonarqube 5.6.7 then 6.7.4 we frequently experience jenkins build failures with this error:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project MyProject: Unable to determine structure of project. Probably you use Maven Advanced Reactor Options with a broken tree of modules. “MyProject:Module” is orphan → [Help 1]

Running the build again is normally successful, worst case running the build a 3rd time succeeds.

sonarqube Version 6.7.4 (build 38452) - LGPL v3 - Community
sonar-maven-plugin:3.4.1.1168
maven goals clean install sonar:sonar
Jenkins ver. 2.121.1
Apache Maven 3.5.3
Red Hat Enterprise Linux Server release 6.6 (Santiago)

1 Like

Hi Thomas,

This message come from the Maven plugin (sonar-maven-plugin). I highly doubt it has any relationship with the SonarQube server version.

The fact the problem is intermittent is really surprising.

Are you using a fixed version of the Maven plugin (locked in your pom) ? Or do you rely on latest release (mvn sonar:sonar).

On Jenkins, are you using a freestyle job, or a Maven job type? I remember Jenkins Maven job type was sometimes trying to do black magic (like only building changed modules).

Thanks for replying Julien!

Relying on the latest release (mvn sonar:sonar). Command is mvn clean install sonar:sonar
Maven job.

The intermittent does make it odd, which provides a work around in a way.

Should I attempt to lock the plugin version?

Should I attempt to lock the plugin version?

You can give it a try. If you don’t want to change all your pom.xml, just change your CI configuration to run mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar. It would be a very good news if it make the behavior consistent (either always failing or passing).

@Thomas_Lowery, @Julien_HENRY
Any update? I am facing a similar issue here…

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project test: Unable to determine structure of project. Probably you use Maven Advanced Reactor Options with a broken tree of modules. “module2” is orphan -> [Help 1]

Command:
-U clean install compile package deploy sonar:sonar -DskipTests -Pdocker -Dproject.version=0.1.{BUILD_NUMBER}-SNAPSHOT -Dbuild.number={BUILD_NUMBER} -Dbuild.revision=${GIT_COMMIT} -Dmaven.test.failure.ignore=false

Note: I am using a multi-module project with 3 modules and a parent pom, the maven sonar plugin is given in the parent pom.

Hi @Shriram_Venkatasubra

If you can share your project so that we could reproduce, that would be great. We don’t need source files, only Maven layout (pom).

@Julien_HENRY This problem is similar to https://jira.sonarsource.com/browse/MSONAR-130. Removing dependeny-reduced pom generation allows for a succesful analysis. So the question you should solution for is, why are the dependency reduced pom causing a problem?

Probably because Maven is removing dependencies relation between modules after shading dependencies, and then we are unable to get project structure.