pmd-eclipse-plugin icon indicating copy to clipboard operation
pmd-eclipse-plugin copied to clipboard

Relative Path to Subset

Open numeralnathan opened this issue 3 years ago • 2 comments

How do I force the PMD Eclipse plugin to use the latest version of the ruleset? The ruleset is in a file on the local disk. I am not sure if this is a missing feature, lack of documentation or my lack of Google skills.

I configured the PMD Eclipse plugin to use a ruleset in the file system. I opened the ruleset in an Eclipse editor. I added a rule to the file and saved it. In the Package Explorer, I right-clicked on a Java file and in the menu clicked PMD > Check Code. The new rule was not used.

If I run PMD on the command line using the ruleset, PMD flags the problems from the new rule. This suggests to me that the PMD Eclipse plugin is not picking up the latest version of the ruleset.

In the menu bar, I clicked on Project > Clean (which rebuilds the project). The PMD Eclipse plugin did not pick up the latest version of the ruleset.

In the menu bar, I clicked File > Restart. The PMD Eclipse plugin did pick up the latest version of the ruleset. This is very slow and seems to be overkill.

In the project properties > PMD, I changed the properties, clicked Apply & Close, and rebuilt the project. The PMD Eclipse plugin did not pick up the latest version of the ruleset.

Note: PMD rulesets can be a hierarchy of files. If any one of the files changes, then the PMD Eclipse plugin should reload the ruleset.

numeralnathan avatar May 23 '21 03:05 numeralnathan

PMD Eclipse plugin does reload the ruleset. The problem is that it would fail to load the ruleset because of this relative path.

<rule ref="rulesets/PMD_ruleset_subset.xml"/>

If I give the full path like below, then the plugin reloads the ruleset.

<rule ref="C:/full/path/rulesets/PMD_ruleset_subset.xml"/>

How do I specify a relative path. Let's assume the base ruleset and PMD_ruleset_subset.xml are in the same directory rulesets. rulesets is a directory in the project.

numeralnathan avatar May 23 '21 14:05 numeralnathan

I'm having the same issue. Is there any way to configure a relative path to a ruleset file?

SoerenHenning avatar Feb 11 '22 21:02 SoerenHenning