Reputation: 671
I have a multi-module Maven project. I added a checkstyle exclusion file in one of my lowest level POM files and specified the <sonar.checkstyle.filters>
with a relative path for that POM, src/sonar_config/checkstyle.suppressions.file
. When I built the module from its home directory that worked fine.
When I compiled the (great-grand-)parent project I got the error [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project sdk: Can not execute Checkstyle: cannot initialize module SuppressionFilter - Unable to find: src/sonar_config/checkstyle.suppressions.file -> [Help 1]
How should I specify the path to the file so that it works correctly from both the low level directory and the parent projects?
Upvotes: 0
Views: 1072
Reputation: 11
sonar.checkstyle.filters=<module name="SuppressionFilter"><property name="file" value="build/check-style-suppression.xml"/></module>
use this property, and specify your own file path, relative to your project root path.
Upvotes: 1
Reputation: 671
It's not pretty, but it's functional.
<sonar.checkstyle.filters>
<![CDATA[<module name="SuppressionFilter">
<property name="file" value="${project.build.sourceDirectory}/../../sonar_config/checkstyle.suppressions.file" />
</module>]]>
</sonar.checkstyle.filters>
If anyone has a better way to specify this I'm open to it.
I suspect this must be a SonarQube bug, because the simple path I found for a FindBugs exclusion didn't work for my Checkstyle exclusion.
Upvotes: 0