pmd / pmd-eclipse-plugin

The pmd-eclipse-plugin integrates the source code analyzer PMD into the Eclipse IDE
Other
93 stars 43 forks source link

Relative Path to Subset #147

Open numeralnathan opened 3 years ago

numeralnathan commented 3 years ago

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 commented 3 years ago

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.

SoerenHenning commented 2 years ago

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