Maven session does not declare a top level project

maven
scanner

(Bartosz) #1

sonar-maven-plugin:3.6.0.1398

For the Maven multimodule hierarchy

group:root
group:root/group:submodule

if the sonar:sonar goal is executed in a reactor build with the “–projects submodule” parameter a following error occurs:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project group:subsubmodule : Maven session does not declare a top level project -> [Help 1

Sonar Maven Plugin should find all parent modules for the specified ones.
As a workaround --also-make option to the reactor build may be used or, if only a single module has been changed, a non-reactor Maven build may be used (in this case for root/submodule/pom.xml). This should also work for a deeper hierarchy, eg. group:root/group:submodule/group:submoduleOfSubmodule