2015-12-15 75 views

回答

2

我通常把它們放在一個單獨的父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>