-
Notifications
You must be signed in to change notification settings - Fork 56
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
An internal error occurred during: "Updating Maven Project" #213
Comments
You can download the old pmd-eclipse-plugin version from here: https://dl.bintray.com/pmd/pmd-eclipse-plugin/releases/4.0.17.v20180801-1551/ (or download the zipped update site: https://dl.bintray.com/pmd/pmd-eclipse-plugin/zipped/net.sourceforge.pmd.eclipse.p2updatesite-4.0.17.v20180801-1551.zip) I'd like to investigate further about the "GuardLogStatement". We definitively support this rule https://pmd.github.io/pmd-6.13.0/pmd_rules_java_bestpractices.html#guardlogstatement . Note that pmd-eclipse-plugin 4.0.17 uses PMD 6.2.0 while pmd-eclipse-plugin 4.2.0 uses PMD 6.13.0. |
Thanks for your quick reply. The ruleset we are using:
|
Thanks for sharing the ruleset. I've first tried it without pmd-eclipse-plugin, and I get the same error. This is obviously a problem in PMD itself (we renamed the rule GuardLogStatementJavaUtil to GuardLogStatement with PMD 6.0.0, and we try to cope with that fact in your ruleset...). I was wondering, which maven-pmd-plugin version you are using? Since you should get the same error when building your project with maven. Your ruleset predates PMD 6 - it was written for PMD 5. We try our best to be able to use such an old ruleset, but sometimes it failes. I suggest to update your ruleset to reference the individual rules in the new categories, that were introduced with PMD 6.0.0. E.g. from rulesets/java/basic.xml you can see, which rules are referenced and take these: <?xml version="1.0"?>
<ruleset name="custom-ruleset"
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>
Defines the rules The Hoff cared about
</description>
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop"/>
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" />
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" />
<rule ref="category/java/errorprone.xml/BrokenNullCheck" />
<rule ref="category/java/errorprone.xml/CheckSkipResult" />
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" />
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement" />
<rule ref="category/java/multithreading.xml/AvoidThreadGroup" />
<rule ref="category/java/multithreading.xml/DontCallThreadRun" />
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking" />
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/performance.xml/BigIntegerInstantiation" />
<rule ref="category/java/performance.xml/BooleanInstantiation" />
<!-- <rule ref="category/java/design.xml/CollapsibleIfStatements" /> -->
<rule ref="category/java/design.xml/SimplifiedTernary" />
</ruleset> The same needs to be done for the other rulesets... |
Many thanks for your information. Our maven-pmd-plugin version is 3.8 |
Ok, m-pmd-p 3.8 uses PMD 5.6.1. This explains why building your project on command line works. I can't explain, why there is no error with pmd-eclipse-plugin 4.0.17. Maybe the error is just suppressed?
That's a different plugin. The m2e-code-quality plugins (this repository here) takes your maven configuration of your project and transfers it into the corresponding eclipse plugins, e.g. pmd-eclipse-plugin. Do you not see this plugin at all or do you see a different version?
Just open "Window, Preferences, PMD" and check the "About" section at the end of the page. |
Hi @wuaaaza , However, I strongly recommend to update your ruleset and update your maven based toolchain to a more recent version of maven-pmd-plugin / PMD. Let me know, if we can close this issue then. |
Loads of thanks for your pmd-eclipse-plugin 4.3.0. It works properly for our projects. I will inform my manager so that he could arrange a time to update our ruleset. |
Ok, thanks for the feedback. |
Hello,
My eclipse (Oxygen 3a Release, EE) updated PMD plugin a few days ago but the latest plugin does not work properly for our java program.
The latest plugin has two jar files:
com.basistech.m2e.code.quality.pmd_1.1.3.201903061028-r.jar
net.sourceforge.pmd.eclipse.plugin_4.2.0.v20190331-1136.jar
The error message turns up when I do Maven/Update project ...
"Unable to exclude rules [GuardLogStatement]; perhaps the rule name is mispelled?"
The previous PMD worked very well in the last two years and the two jar files were:
com.basistech.m2e.code.quality.pmd_1.0.0.201705301746.jar
net.sourceforge.pmd.eclipse.plugin_4.0.17.v20180801-1551.jar
After I remove the latest PMD plugin in eclipse, the error message disappears and "Maven/Update project ..." works properly again.
I could not find the old installation package in Eclipse Market place. I have downloaded its latest source code, and compiled it at my computer but got the same error message. Besides, my colleagues got the same error message when he used the latest Eclipse.
Could you tell me how to generate the old installation file or address my problem in using your latest PMD plugin? Many thanks. The error message in Error log of Eclipse:
Message: An internal error occurred during: "Updating Maven Project".
Exception Stack Trace:
java.lang.IllegalArgumentException: Unable to exclude rules [GuardLogStatement]; perhaps the rule name is mispelled?
at net.sourceforge.pmd.RuleSetFactory.parseRuleSetReferenceNode(RuleSetFactory.java:536)
at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:459)
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 com.basistech.m2e.code.quality.pmd.EclipsePmdProjectConfigurator.locatePmdRules(EclipsePmdProjectConfigurator.java:230)
at com.basistech.m2e.code.quality.pmd.EclipsePmdProjectConfigurator.createOrUpdateEclipsePmdConfiguration(EclipsePmdProjectConfigurator.java:156)
at com.basistech.m2e.code.quality.pmd.EclipsePmdProjectConfigurator.handleProjectConfigurationChange(EclipsePmdProjectConfigurator.java:112)
at com.basistech.m2e.code.quality.shared.AbstractMavenPluginProjectConfigurator.mavenProjectChanged(AbstractMavenPluginProjectConfigurator.java:183)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.mavenProjectChanged(ProjectConfigurationManager.java:1036)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.notifyProjectChangeListeners(ProjectRegistryManager.java:783)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.applyMutableProjectRegistry(ProjectRegistryManager.java:930)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:300)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:405)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:352)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1351)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:349)
at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Session Data:
eclipse.buildId=4.7.3.M20180330-0640
java.version=1.8.0_161
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_ZA
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -data file:/home/wuaaaza/eclipse-workspace/ -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
The text was updated successfully, but these errors were encountered: