I have quite a large multi-module multi-language maven project (~100 modules in total), which I want to analyze using SonarQube and since the scanner doesn't automatically discover all files in all languages (i.e. not for Groovy and Kotlin), I have to tell it where to look for the files.
Most module contain the typical combination of a src/main/
and a src/test/
directory but not necessarily both, which makes it impossible to simply declare <sonar.sources>pom.xml,src/main/</sonar.sources>
and <sonar.tests>src/test/</sonar.tests>
as properties in the top level pom, since the missing directory causes maven to abort with an error.
According to https://stackoverflow.com/a/37545474 one possible solution to this problem is to set ...
sonar.sources
to be.
sonar.inclusions
to besrc/main/**
- => this will include all the known files that SQ finds in your modules in the src/main folder if it exists
and using just
<sonar.sources>.</sonar.sources>
<sonar.tests>.</sonar.tests>
<sonar.inclusions>pom.xml,src/main/**</sonar.inclusions>
<sonar.test.inclusions>src/test/**</sonar.test.inclusions>
in the top level pom indeed works as expected (all files, that are supposed to be analyzed, are found and no errors are reported because of missing directories) but it also causes the following warning, which shows up in SonarQube as well:
[WARNING] Specifying module-relative paths at project level in the property 'sonar.inclusions' is deprecated. To continue matching files like 'frontend/pom.xml', update this property so that patterns refer to project-relative paths.
All paths I tried so far either cause less files to be analyzed in total or result in an error because individual files would be indexed multiple times, due to non disjoint sets produced by the inclusion patters. Thus the question ...
How do I have to use the *.inclusions
properties to get rid of the warning, while still analyzing all files in all submodules?