2016-12-06 99 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