Affected Version
2.1.0 on Intellij IDEA 2025.3.4
Description:
None of the apex related PMD rules work any longer. Referencing them in a rule set breaks the rule set.
Steps to replicate:
- Create a rule set xml containing:
<?xml version="1.0"?>
<ruleset name="Custom Rules"
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 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>
My custom rules
</description>
<rule ref="category/apex/bestpractices.xml/AvoidGlobalModifier" />
</ruleset>
- Try to load it as a rule set under: Settings | Tools | PMD | RuleSets | +
Expected result:
The file should be accepted.
Actual result:
Error: "The selected file/URL is not valid for PMD 7. PMD: Cannot load ruleset category/apex/bestpractices.xml/AvoidGlobalModifier: Cannot resolve rule/ruleset reference 'category/apex/bestpractices.xml/AvoidGlobalModifier'. Make sure the resource is a valid file ..."
Further reference:
https://pmd.github.io/pmd/pmd_rules_apex_bestpractices.html#avoidglobalmodifier defines this rule and is currently supported.
Workaround:
Reverting the Plugin to Version 2.0.7. where the rules can still be referenced.
Affected Version
2.1.0 on Intellij IDEA 2025.3.4
Description:
None of the apex related PMD rules work any longer. Referencing them in a rule set breaks the rule set.
Steps to replicate:
Expected result:
The file should be accepted.
Actual result:
Error: "The selected file/URL is not valid for PMD 7. PMD: Cannot load ruleset category/apex/bestpractices.xml/AvoidGlobalModifier: Cannot resolve rule/ruleset reference 'category/apex/bestpractices.xml/AvoidGlobalModifier'. Make sure the resource is a valid file ..."
Further reference:
https://pmd.github.io/pmd/pmd_rules_apex_bestpractices.html#avoidglobalmodifier defines this rule and is currently supported.
Workaround:
Reverting the Plugin to Version 2.0.7. where the rules can still be referenced.