I would like to use the same Ruleset in my IDE (Eclipse) that my Sonar profile.
I got the PMD XML ruleset from the Sonar Permalinks and would like to import it into my PMD Eclipse Plugin but when i try to do it, the "OK" button is desactivated ...
Can someone help me ?
The advice from Ivan Nikolov helped me, but I had to also change one rule from:
to
Here is my PMD configuration file from sonar which is working for me with PMD-plugin 4.0.2.:
Why don't you use Sonar Eclipse ? You wouldn't need to worry about synchronization of rule sets.
Ivan Nikolov's answer is correct. Your problem are different versions of ruleset format . In my case I was trying to import ruleset exported from PMD plugin version 3.2.6 into plugin version 4.0.0. Here are my findings:
After these changes I was able to import manually migrated custom ruleset file into PMD plugin 4.0.0.
Hope this helps.
BTW: I find 4.0.0 version of PMD plugin very buggy so I downgraded back to 3.2.6
The problem could be that Sonar is exporting your ruleset for v4.x format and your Eclipse plugin expects them in v5.x format.
Try changing your rules from:
to
Please note the ref attribute. A simple find and replace all will work out fine for you.
In addition to what others said, you may also have to find this:
and replace it by this:
I had to add the language to my XPath rule(s) as well, e.g: