On 20/01/2011, at 11:36 PM, Mathias Kalb wrote:
> Hi,
>
> Checkstyle has a SuppressionFilter. You need to define a XML file with
> suppression rules.
>
> config/checkstyle/checkstyle.xml
>
> <module name="SuppressionFilter">
> <property name="file" value="config/checkstyle/suppressions.xml"/>
> </module>
The checkstyle SuppressionFilter interprets the file name relative to the
working directory of the process, rather than something fixed, such as relative
to the configuration file.
Here's (more or less) how we deal with this problem in the Gradle build:
checkstyleProperties.checkstyleConfigDir = checkstyleConfigFile.parentFile
in the checkstyle config file:
<module name="SuppressionFilter">
<property name="file" value="${checkstyleConfigDir}/suppressions.xml"/>
</module>
That is, we inject the path to the config directory into the config file, so
that the paths are always absolute and independent of the process' working
directory.
This approach works regardless of whether you have a shared config file or one
config file per project.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz