NoamEpstein
NoamEpstein

Reputation: 127

How can I update PMD to newer version?

I have an Android library and an Android App project, what use the library PMD.

We use an older version and I am asked to update this PMD library to a more recent version 6.X.X

In the project, I found a rules-pmd.xml file with:

 <?xml version="1.0"?> <ruleset
     name="My rules"
     xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
     xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0
http://pmd.sourceforge.net/ruleset_5_3_1.xsd">

Changing this xml to

http://pmd.sourceforge.net/ruleset_6_12_0.xsd

did not help. And then in the modules build.gradle:

apply from: "$path/script-pmd.gradle"

Could not find any other version for PMD..

Where can I change the used PMD version?

Upvotes: 1

Views: 2390

Answers (2)

adangel
adangel

Reputation: 1910

You can check on the main homepage https://pmd.github.io which version is the latest. Currently PMD 6.12.0 is the latest version.

In your ruleset pmd-rules.xml, you are referencing the schema XSD. But here you need to reference https://pmd.sourceforge.io/ruleset_2_0_0.xsd since you are using the ruleset schema version 2 (btw. http://pmd.sourceforge.net/ruleset_5_3_1.xsd doesn't exist at all). However, this does not matter, since the ruleset is not validated against the schema when PMD loads it.

More relevant seems to be the file script-pmd.gradle. Do you have this file? I guess, that there the gradle pmd plugin is configured. This plugin has a property which controls the version of PMD: toolVersion

For example, your configuration could be adjusted to look like this:

pmd {
  ignoreFailures = false
  sourceSets = [sourceSets.main]
  reportsDir = file("$project.buildDir/reports/pmd")
  ruleSets = [],
  ruleSetFiles = files("pmd-rules.xml")
  toolVersion = "6.12.0"
}

Upvotes: 1

Elio Lako
Elio Lako

Reputation: 1351

As for the given question, you have to ask the libraries authors. Also you can take a look at the given library web link for more information about that.

Update : in the given code you are seeing about making ruleset, as stated here so you have to check somewhere else for that.

For example, i just checked and stated here you will find the needed information : follow the link

The new version needs to be entered into _config.yml, e.g.:

pmd:
latestVersion: 6.0.0
latestVersionDate: 15th December 2017

_config

Upvotes: 1

Related Questions