[英]Change Maven CheckStyle configuration
我正在使用Checkstyle Maven來檢查代碼質量。 盡管有些事情我想在CheckStyle中關閉。
有一個模塊負責尾隨空格。 它給出的評論是:
Line has trailing spaces.
現在,我假設要注意的模塊稱為RegexpSingleline,我想將其關閉。 我已經嘗試通過取消注釋./myproject/target/checkstyle-checker.xml
的文件來進行./myproject/target/checkstyle-checker.xml
,但是當我運行mvn site
該文件會再次自動生成,並且我./myproject/target/checkstyle-checker.xml
更改消失了。
我將如何關閉該鼠頭?
您應該復制checkstyle-checker.xml
文檔並將其存儲在/target
之外(因為該目錄將在構建中被覆蓋!)。 然后,在pom.xml
您可以在checkstyle插件配置中指定此位置(請參閱: http : //maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-checker-config.html )
<project>
...
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>..your version of the plugin..</version>
<configuration>
<configLocation>..your location../checkstyle-checker.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
...
</project>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.