I would like to use the gradle PMD plugin in an enterprise project which is built with gradle.
I have a pmd_rules.xml
file which already works, but I can't add own java rules (I get a class not found exception). I followed the tutorial on it's website.
Where do I have to put my own rules so they get recognized by gradle and PMD? Has somebody already done something like that?
pmd.gradle:
apply from: rootProject.file("core/modules.gradle"), to : ext
if(project.name in (modules["modules"] +modules["modules"])){
apply plugin: 'pmd'
pmd {
ignoreFailures = true
ruleSetFiles = rootProject.files("../repo/pmd_rules.xml")
sourceSets = [sourceSets.main,sourceSets.test]
targetJdk = org.gradle.api.plugins.quality.TargetJdk.VERSION_1_7
ruleSets = []
toolVersion = "5.0.5"
}
}
The PMD plugin performs quality checks on your project's Java source files using PMD and generates reports from these checks.
The user can run pmd on a single or set of files/folders and see the results in intelliJ. To run the predefined rulesets, go to Tools -> PMD -> PreDefined menu. PMD supports custom ruleset file, to configure goto settings -> PMD and add the rule set files that are required.
tasks.withType(Pmd) {
pmdClasspath += file("path/to/rules.jar")
}
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