Using Checkstyle’s suppression filters on Windows and Linux

I have already shown the usage of Checkstyle’s suppression filters in Eclipse and Maven in [1]. But after switching from Linux to Windows (please no comments on that…) I wondered about occurring Checkstyle rule violations I actually had excluded in my checkstyle-suppressions.xml. Those rules were mainly simple exclusions of all files within a certain package:

<suppress checks="[a-zA-Z0-9]*" files="src/main/java/de/foo/bar" />

After searching around, I realized that this was an issue with the given regex in the files-attribute [2]. The simple slash was correctly interpreted on Linux, but didn’t work on Windows. So to make the rules work on both operation systems I replaced the path separator with “[/\\]”:

<suppress checks="[a-zA-Z0-9]*" files="src[/\\]main[/\\]java[/\\]de[/\\]foo[/\\]bar" />


  1. [1]
  2. [2]

Rolf Engelhard


Comments (2) Write a comment

Leave a Reply

Required fields are marked *.