<p>I have a checkstyle suppression filter setup (e.g. ignore magic numbers in unit test code).</p>

<p>The suppression xml file resides in the same folder as the checkstyle xml file. However, where this file actually is varies:
on my windows dev box it is in d:\dev\shared\checkstyle\config
on the Linux CI server it will be in /root/repo/shared/checkstyle/config
on another developers box it could be anywhere (they check out their svn repo to).</p>

<p>The only "consistent" thing is that the suppression file is always in the same folder as the checkstyle xml file.
I cannot work out how to ensure that this file is always consistently picked up. Also I don't know why checkstyle does not support embedded suppression within the checkstyle xml file.</p>

<p>any help?</p>

I had this same problem with the Checkstyle suppression configuration when I was going back and forth between Linux and Windows. Here's how I solved it in my Ant-based build system:
Basically, I inject the proper, platform-specific directory value into the main Checkstyle configuration file by configuring a Checkstyle properties file with an Ant build script.
My main Checkstyle configuration file has a
```
SuppressionFilter
```
module declaration as shown below. The value of the
```
checkstyle-suppressions-file
```
property comes from a Checkstyle properties file:
```
```
<module name="SuppressionFilter">
    <property name="file" value="${checkstyle-suppressions-file}"/>
</module>
```
```
The Checkstyle properties file is not static, it is generated by an Ant build script from a properties file template called
```
template-checkstyle.properties
```
. Here's what the template looks like for the suppressions file property:
```
```
checkstyle-suppressions-file=@SCM_DIR@/checkstyle_suppressions.xml
```
```
My Ant build script copies this file to a file named
```
checkstyle.properties
```
. The copy has the special token replaced with the proper value of the directory in which the suppressions file is found:
```
```
<copy file="${scm.dir}/template-checkstyle.properties" tofile="${scm.dir}/checkstyle.properties">
    <filterset>
        <filter token="SCM_DIR" value="${scm.dir.unix}"/>
    </filterset>
</copy>
```
```
Now, where does the value of
```
scm.dir.unix
```
come from? Well, it's
derived
from a property of my build, read on. You'll need to specify such a value with the directory values that you mentioned.
Note that there is one slightly non-obvious issue concerning the way in which you specify this directory. I say that the
```
scm.dir.unix
```
value is derived from a build property because I observed that the main Checkstyle configuration file cannot contain backslashes, i.e. Windows path separator characters, in the value of the
```
file
```
property of the
```
SuppressionFilter
```
module. For example, specifying something like
```
C:\foo\bar\baz
```
leads to a Checkstyle error message saying that
```
C:foobarbaz
```
cannot be found. I work around this by "converting" the
```
scm.dir
```
directory build property to a "unix" format with Ant's
```
pathconvert
```
task:
```
```
<pathconvert targetos="unix" property="scm.dir.unix">
    <path location="${scm.dir}"/>
</pathconvert>
```
```
Then I call the
```
checkstyle
```
Ant task like this:
```
```
<checkstyle config="${scm.dir}/checkstyle_checks.xml"
            properties="${scm.dir}/checkstyle.properties">
    <!-- details elided -->
</checkstyle>
```
```
The call to the
```
checkstyle
```
task injects the key/value pairs contained in the
```
checkstyle.properties
```
file into the main Checkstyle configuration.
If you like, you can see the full scripts
here
Hope this helps