SonarQube multip project scanning

Trying to setup my multi-module project (AWS Serveless generated by IntelliJ) to run.
This is running on a MacBook pro - Java8 and Maven 3.6.1
When running the following command in the project root, it works 100%

mvn sonar:sonar

However, when I set these three properties in the pom.xml it fails with a StackOverflow exception in the following class:

pom.xml entry looks like this:


I have moved the pom entries between the different modules, no difference. Even tried setting the <sonar.projectBaseDir> and <> properties, but no go.

This is running the : mvn sonar:sonar command from a terminal.

Running mvn sonar:sonar from the module’s folder works fine, just not from the top-level folder.
Any help will be appreciated!


Welcome to the community!

First, there shouldn’t be any need to manually set sonar.projectKey for a Maven project/analysis; that will be picked up automatically from your pom. Regarding your command line versus your pom entry, these are not exactly the same because in the pom you’ve also added sonar.language. So you know, that property doesn’t work in the current version - altho I realize now you haven’t included the version of SonarQube you’re trying to use. At any rate, I’d drop it.

There’s also no need to set sonar.projectBaseDir and; these are also things that “just work” 99.5% of the time.

Perhaps you could share your project structure and what you’re trying to accomplish?


Thank you for the help. Got this going as follows:

  1. SonarCube server admin page - create project and key.
  2. In main Java project pom.xml - set the three parameters -> projectKey, login and url
  3. In each of the module pom.xml files, set the projectKey property only. Increment each key so that all the keys are unique. Without a unique key it will throw the stack overflow exception.
    So my keys are something like :

This works 100% for my requirements. In Bamboo I now have a a simple mvn sonar:sonar step. Can also do this (mvn sonar:sonar) from the dev machines. No need to change folders, etc in the build scripts. So 100% happy!

Hope this helps somebody else.

1 Like