This answer tries to fill in missing details in the previous answers.
Suppose I have the following maven project, which only lists the directories inside the project.
.
├── pom.xml
└── src
├── main
│ ├── java
│ │ └── edu
│ │ └── utexas
│ │ └── cs
│ │ ├── liveoak
│ │ │ ├── common
│ │ │ ├── tree
│ │ │ └── zero
│ │ ├── logging
│ │ └── sam
│ │ ├── core
│ │ │ └── instructions
│ │ ├── io
│ │ ├── ui
│ │ │ └── components
│ │ └── utils
│ └── resources
│ ├── sam-checks.xml
│ └── sam-suppressions.xml
└── test
sam-checks.xml is the checkstyle configuration file and sam-suppressions.xml is the suppression xml document. Inside sam-checks.xml, I have
<module name="SuppressionFilter">
<property name="file" value="src/main/resources/sam-suppressions.xml"/>
<property name="optional" value="false"/>
</module>
Note the location of sam-suppressions.xml is relative to the pom.xml of the project.
I want to suppress the checks for all the java files under sam directory (main/java/edu/utexas/cs/sam). To do so, my sam-suppressions.xml looks like below
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="[a-zA-Z0-9]*"
files="[\\/]sam[\\/]"/>
</suppressions>
I verify my setup with mvn checkstyle:check. Everything should work.