覆盖maven checkstyle中的一条规则

Override one rule in maven checkstyle

我目前正在使用带有 google 规则的 maven checkstyle。

每当我 运行 我收到消息 [...] (coding) HiddenField: 'userId' hides a field. 我想隐藏它而不创建我自己的规则 xml 文件。

有没有办法在不替换整个 xml 文件的情况下覆盖 checkstyle 中的规则?

到目前为止我的代码:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <version>2.17</version>
    <configuration>
        <configLocation>google_checks.xml</configLocation>
    </configuration>
</plugin>

是的,您可以使用额外的抑制文件来抑制规则。您可以在 http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/suppressions-filter.html

查看示例