Configuring eclipse plugin PMD to use multiple rulesets
I find PMD very useful tool. So I have installed PMD eclipse plugin.
With PMD, we can define multiple ruleset files. One of the reason I have multiple rulesets file is that I need to exclude some classes from some rules say naming开发者_Python百科 rules but not all. I achieved this by defined those rules in a separate ruleset file and using element. This is fine as far ant build is concerned. However, I would like to use the same ruleset files for PMD eclipse plugins to ensure that executing PMD using ant or eclipse generates same result.
I do not see an option to select multiple ruleset files for PMD eclipse plugin. Is there a way to select multiple ruleset files or any other alternative?
Please help.
Thanks
A rulesets references rules and built-in rulesets - and it can reference custom rulesets too. Just create a wrapper-ruleset.xml for basic-ruleset.xml and codesize-ruleset.xml:
<ruleset xmlns="http://pmd.sf.net/ruleset/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="pmd-eclipse" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
<rule ref="basic-ruleset.xml"/>
<rule ref="codesize-ruleset.xml"/>
</ruleset>
You can then use wrapper-ruleset.xml in Eclipse.
精彩评论