我有问题。看起来我的checkstyle-supressions被忽略了。我确定文件的路径是正确的(checkstyle.xml正确加载),但checkstyle-supressions没有工作。你知道whot可能是错的吗? 以下是我的maven配置:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
...
<profiles>
<profile>
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<configLocation>custom-checkstyle.xml</configLocation>
<suppressionsLocation>custom-checkstyle-suppressions.xml</suppressionsLocation>
<includeTestSourceDirectory>false</includeTestSourceDirectory>
<enableFilesSummary>true</enableFilesSummary>
<failsOnError>true</failsOnError>
<consoleOutput>true</consoleOutput>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
...
</project>
我的自定义checkstyle-supressions文件:
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.0//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
<suppressions>
<suppress checks=".*"
files="src/main/java/model/Player.java"/>
</suppressions>
非常感谢
答案 0 :(得分:0)
我必须添加
<module name="SuppressionFilter">
<property name="file" value="custom-checkstyle-suppressions.xml"/>
</module>
到checstyle.xml中的Checker模块