I am using the plugin PMD for Eclipse and have zeroed in on a set of rules preexisting in my PMD rules configuration. I want to share these set of rules with my team mates . But when i try and export the Rules from PMD, it either exports only one rule OR if I use Ctrl + A on all the rules, it exports the rules but doesn't remember which rule was checked and which was unchecked.

Deleting rules that are not useful and then exporting only selected rules leads to hardcoding of the loaction of the XML file in the rule set . For Example, If my xml file is stored in location X in my local directory, the rulesets become <rule ref="X/custom_PMD_rules.xml/AbstractClassWithoutAbstractMethod"/>

What is the correct way of sharing a set of rules in a team in PMD? I was able to share the rules in Checkstyle and code templates using simple export and import. Then why not in PMD.

1

There are 1 best solutions below

0
On

I use an XML ruleset file to share rules with teammates. The ruleset can use a relative path to refer to other files. Or if all the rules are in one file, you can just import them to Eclipse and the location doesn't matter.