2016-12-06 105 views
1

我目前正在使用maven checkstyle和google规则。覆盖maven checkstyle中的一条规则

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

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

我迄今为止代码:

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

回答

1

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

+0

看到一个例子谢谢。我试过了,好像没有使用压缩文件。无论我输入什么路径,它都没有什么区别,即使是无效的。 – Freddy

+1

@Freddy你有没有看到[那个问题](http://stackoverflow.com/a/15828041/1743880)?你能发布你试过的抑制文件吗? – Tunaki

+0

我现在有解决方案。我的配置错误。我需要为每个目标进行配置。 – Freddy