I am trying to run PMD with a custom rule set file, but this rule set includes a rule, which is a regular class. This class exists in the bank, which is not delayed as a dependency, but instead enters a zip file (which is dependent) and is unpacked. Imagine the PMD rule class is only in build/extralib/blah.jar .
How to include this in my classpath when starting PMD? What I tried but did not work:
pmd { ruleSetFiles = files("build/utils/pmd-rules.xml") pmdClasspath = files("build/extralib") }
To be clear, the error is: java.lang.ClassNotFoundException: com.package.for.pmd.CrazyRule . This happens when pmdMain starts.
Secondary question: what is the difference between Pmd and PmdExtension ? Pmd has pmdClasspath , but PmdExtension does not. When I added pmdClasspath , I got:
Creating properties on demand (aka dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties. Deprecated dynamic property: "pmdClasspath" on " org.gradle.api.plugins.quality.PmdExtension_Decorated@70221fc5 ", value: "file collection".
So, I suppose that he adheres only to PmdExtension? As a newbie to Gradle, this is a bit confusing ...
source share