Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle missing rules due to wrong PMD version #62

Open
adangel opened this issue Sep 27, 2018 · 1 comment
Open

Gracefully handle missing rules due to wrong PMD version #62

adangel opened this issue Sep 27, 2018 · 1 comment

Comments

@adangel
Copy link
Member

adangel commented Sep 27, 2018

When using m2e + m2e-code-quality + pmd-eclipse-plugin, configuration of the project might fail, if the PMD versions don't match. E.g. the PMD version in the project might be newer than the one used by eclipse.

Example stack trace:

Sep. 27, 2018 2:01:59 NACHM. net.sourceforge.pmd.rules.RuleFactory buildRule
SCHWERWIEGEND: Error instantiating a rule
java.lang.ClassNotFoundException: net.sourceforge.pmd.lang.java.rule.basic.OverrideBothEqualsAndHashcodeRule cannot be found by net.sourceforge.pmd.eclipse.plugin_4.0.17.v20180801-1551
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:508)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:419)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:411)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
	at net.sourceforge.pmd.rules.RuleBuilder.build(RuleBuilder.java:179)
	at net.sourceforge.pmd.rules.RuleFactory.buildRule(RuleFactory.java:189)
	at net.sourceforge.pmd.RuleSetFactory.parseSingleRuleNode(RuleSetFactory.java:562)
	at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:461)
	at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.java:367)
	at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:214)
	at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:209)
	at net.sourceforge.pmd.RuleSetFactory.createRuleSets(RuleSetFactory.java:170)
	at net.sourceforge.pmd.RuleSetFactory.createRuleSets(RuleSetFactory.java:154)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.loadRuleSetFromProject(ProjectPropertiesManagerImpl.java:175)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.fillProjectProperties(ProjectPropertiesManagerImpl.java:246)
	at net.sourceforge.pmd.eclipse.runtime.properties.impl.ProjectPropertiesManagerImpl.loadProjectProperties(ProjectPropertiesManagerImpl.java:116)
	at net.sourceforge.pmd.eclipse.plugin.PMDPlugin.loadProjectProperties(PMDPlugin.java:510)
	at net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd.getProjectProperties(ReviewCodeCmd.java:442)
	at net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd.processResourceDelta(ReviewCodeCmd.java:616)
	at net.sourceforge.pmd.eclipse.runtime.cmd.ReviewCodeCmd.execute(ReviewCodeCmd.java:219)
	at net.sourceforge.pmd.eclipse.runtime.cmd.JobCommandProcessor$1.run(JobCommandProcessor.java:93)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)

Other example:
grafik

An internal error occurred during: "Updating Maven Project".
Unable to find referenced rule IdenticalCatchBranches; perhaps the rule name is mispelled?
@adangel
Copy link
Member Author

adangel commented Apr 24, 2019

Similar case: m2e-code-quality/m2e-code-quality#213

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant