【问题标题】:Override one rule in maven checkstyle覆盖 maven checkstyle 中的一条规则
【发布时间】:2016-12-06 21:07:13
【问题描述】:

我目前正在使用 maven checkstyle 和 google 规则。

每当我运行它时,我都会收到消息 [...] (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>

【问题讨论】:

    标签: java maven checkstyle


    【解决方案1】:

    是的,您可以使用附加的禁止文件来禁止规则。你可以在http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/suppressions-filter.html看到一个例子

    【讨论】:

    • 谢谢。我试过了,似乎没有使用抑制文件。无论我输入什么路径,都没有任何区别,即使是无效路径。
    • @Freddy 你看到that question了吗?您可以发布您尝试过的禁止文件吗?
    • 我现在有了解决方案。我的配置放错地方了。我需要为每个目标配置它。
    猜你喜欢
    • 2012-10-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-05
    相关资源
    最近更新 更多