However with sonar.maven.scanAll=true, our build throws an error that the scanner tries to index mutiple times the same maven files.
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar (default-cli) on project foo-parent: File parent/pom.xml can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files -> [Help 1]
I guess that if we exclude maven related files, it wont scan java files anymore right ?
I’ll look for a workaround and post it here if I find one.
I guess what’s happening, is that the option scanAll is not aware of -f parent and tries to scan parent/pom.xml a second time.
When we execute it without -f ./parent, the scan runs fine. (because it uses the “root” pom)
But unfortunately we can’t just do that because it omits several of our modules.
I didn’t got the time yet to try some workarounds.
Any hints welcomed !
To avoid the error parent/pom.xml can't be indexed twice,
We moved our sonar settings from parent/pom.xml into our settings.xml
(it seem that since 7.6 we should not put the sonar profile config inside the pom anymore)
Next week we’ll to compare reports more in depth.
But it seem fine so far.
Well, what fixed the error was not the fact that we moved the sonar settings outside the pom…
But rather the fact that we modified mvn -f ./parent to mvn -f parent (notice the ./ )
It’s weird, but it works…