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>