When using Maven with the various plugins for PMD, Checkstyle and/or Findbugs, what would be the recommended location for placing your custom ruleset file?
I usually place them in a separate parent pom, this way I can reuse them later on in other modules or projects. Similar to the proposition on checkstyle page (https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html) but I keep it out of the main project.
You place the files a module named build-tools
in which you have src/main/resources/your/package with checkstyle and pmd config and then configure given plugin with:
<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 is more tricky, I usually leave it as it is, and sometimes only use @SuppressFBWarnings
from:
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>3.0.1</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With