I have a modest custom pmd.xml to limit some of the warnings that I'm not concerned about. I imported it by using Preferences => PMD => RuleSets => + => navigating to my file (which is in the intellij project structure).
The option under Tools => Run PMD => Custom Rules => (filename) then becomes active and I am able to select it to run it. However, I never get any results from this custom ruleset. I know there are some violations to find, because I get reports when running it through maven, but not with the plug-in.
<?xml version="1.0"?>
<ruleset name="my_pmd"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<rule ref="rulesets/java/android.xml"/>
<rule ref="rulesets/java/basic.xml"/>
<rule ref="rulesets/java/braces.xml"/>
<rule ref="rulesets/java/codesize.xml">
<!-- This was too strict, doesn't account for ctors, equals, hashCode, to String, etc. -->
<exclude name="TooManyMethods"/>
</rule>
<rule ref="rulesets/java/design.xml">
<exclude name="TooFewBranchesForASwitchStatement"/>
</rule>
<rule ref="rulesets/java/empty.xml"/>
<!--
<rule ref="rulesets/java/naming.xml"/>
-->
<rule ref="rulesets/java/strictexception.xml"/>
<rule ref="rulesets/java/strings.xml"/>
<rule ref="rulesets/java/typeresolution.xml"/>
<rule ref="rulesets/java/unnecessary.xml">
<exclude name="UselessParentheses"/>
</rule>
<rule ref="rulesets/java/unusedcode.xml"/>
<rule ref="rulesets/java/optimizations.xml">
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="MethodArgumentCouldBeFinal"/>
</rule>
</ruleset>