5
將Maven與PMD,Checkstyle和/或Findbugs的各種插件一起使用時,推薦放置自定義規則集文件的位置是什麼?什麼是PMD/checkstyle/findbugs自定義規則集的推薦位置?
將Maven與PMD,Checkstyle和/或Findbugs的各種插件一起使用時,推薦放置自定義規則集文件的位置是什麼?什麼是PMD/checkstyle/findbugs自定義規則集的推薦位置?
我通常把它們放在一個單獨的父pom中,這樣我可以在以後的其他模塊或項目中重用它們。 類似於checkstyle頁面上的提議(https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html),但我將其保留在主項目之外。
您將文件命名中,你的src /主/資源/你/包的CheckStyle和PMD的配置,然後配置給插件與build-tools
模塊:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>com.example.whizbang</groupId>
<artifactId>build-tools</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
FindBugs的是更棘手的,我通常會保留原樣,有時僅使用@SuppressFBWarnings
來自:
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>3.0.1</version>
</dependency>