With Gradle 1.5 - PMD applying basic rules even when they are not included in our rule set files

We have pmdMain configuration like this:

pmdMain {

ruleSets = []

ruleSetFiles = files([

“$projectRoot/buildtools/pmd-rules/strings.xml”,

“$projectRoot/buildtools/pmd-rules/strictexception.xml”,

“$projectRoot/buildtools/pmd-rules/optimizations.xml”,

“$projectRoot/buildtools/pmd-rules/migrating.xml”,

“$projectRoot/buildtools/pmd-rules/logging-java.xml”,

“$projectRoot/buildtools/pmd-rules/imports.xml”,

“$projectRoot/buildtools/pmd-rules/design.xml”,

“$projectRoot/buildtools/pmd-rules/coupling.xml”,

“$projectRoot/buildtools/pmd-rules/controversial.xml”,

“$projectRoot/buildtools/pmd-rules/codesize.xml”,

“$projectRoot/buildtools/pmd-rules/clone.xml”,

“$projectRoot/buildtools/pmd-rules/basic.xml”

])

}

After 1.5 upgrade builds have started failing with rules not included in our rule set files. For example: [Basic Rules.CollapsibleIfStatements] - These nested if statements could be combined

This rule is not defined in any of our ruleset files. Any help is appreciated.

Looks like a regression to me, and so far I haven’t found a workaround. We’ll keep you informed.

Is there a chance this be fixed in RC2? Or should we rollback to 1.4.

If there is an RC2, it will contain a fix for this issue. We should know soon enough. In the meantime, you could try to work around with 'ruleSets = [

“$projectRoot/buildtools/pmd-rules/strings.xml”,

“$projectRoot/buildtools/pmd-rules/strictexception.xml”, …]’. I haven’t tested this, but it might work.

Awesome. That works. Thanks.

Still seems to be an issue with 1.10 The workaround does work however…