[WARNING] File is ignored. It is not located in module basedir

Thanks, that helps me understand the problem.

There are a few notes about this particular setup:

  • Setting a property in the command line (with -D...) will set it for all modules. This is usually not what is intended.
  • It’s not possible to add source code to Modules of type pom. Anyway if it was possible, it wouldn’t work correctly. Java source code needs to be analyzed in a certain context with the a classpath and bytecode, and this wouldn’t be available in that module.
  • SonarQube offers a view over the entire project (all modules) so it’s not possible to include the same files in different Maven modules

With this in mind, the only option I see is to add ParentProject/src/main/java to one of the child projects.
This can be done by adding, for example in Child_Module1/pom.xml:

<properties>
    <sonar.projectBaseDir>..</sonar.projectBaseDir>
    <sonar.sources>../src/main/java,pom.xml</sonar.sources>
</properties>

You can try to not define sonar.sources and see if it picks up sourceDirectory correctly, if it doesn’t you can override it like that and add other sources within the module.

1 Like