SuppressionFilter を使うときはファイルパスを指定しないといけないので面倒です。
${project}/configuration/checkstyle.xml
<module name="Checker">
<property name="charset" value="UTF-8"/>
...
<module name="SuppressionFilter">
<property name="file" value="${checkstyleConfigDir}/checkstyle-suppressions.xml"/>
</module>
</module>
${checkstyleConfigDir}
を Gradle からインジェクトします。Gradle 経由で Checkstyle を実行するときは charset 指定も忘れずに。
${project}/configuration/checkstyle-suppressions.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress checks=".*" files="src/test/java/.*" />
</suppressions>
${project}/build.gradle
def checkstyleConfigDir = new File(buildscript.sourceFile.parentFile, configurationDir)
checkstyle {
configFile = new File(checkstyleConfigDir, "checkstyle.xml")
configProperties.checkstyleConfigDir = checkstyleConfigDir
}