Home > OS >  Why is PMD give different results for Eclipse and Gradle?
Why is PMD give different results for Eclipse and Gradle?

Time:01-02

I am using the eclipse-pmd plugin, and I am also using PMD via the following Gradle configuration:

plugins {
  id 'pmd'
}

pmd {
  consoleOutput = true
  ruleSets = []
  ruleSetFiles = files("pmd-ruleset.xml")
  toolVersion = "6.41.0"
}

Both methods are configured to use the same ruleset, and my PATH variable points to PMD 6.41.0 (which I think is what the Eclipse plugin uses), and yet both give different results.

For example, running ./gradlew pmdMain complains about the rule AvoidUncheckedExceptionsInSignatures, but eclipse-pmd does not flag this up at all.

Why might this be?

CodePudding user response:

It turns out that the eclipse-pmd plugin (which I found in C:\Users\{username}\.p2\pool\plugins) comes packaged with its own version of PMD, which in this case is 6.28.0.

This doesn't fully explain the discrepency, since the AvoidUncheckedExceptionsInSignatures rule has been around since PMD 6.13.0, but I'm happy enough to blame the difference in versions for the difference in output.

  • Related