由于"Absent Code attribute in method that is not native or abstract in class file",Maven-pmd-插件执行失败



我正在尝试添加

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.9.0</version>
<executions>
<execution>
<id>pmd-check</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<printFailingErrors>true</printFailingErrors>
<rulesets>
<ruleset>code-analysis/ruleset.xml</ruleset>
</rulesets>
</configuration>
</plugin>

ruleset.xml

<?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 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
The default ruleset
</description>
<rule ref="rulesets/java/strings.xml">
<exclude name="AvoidDuplicateLiterals"/>
</rule>
<rule ref="rulesets/java/strings.xml/AvoidDuplicateLiterals">
<properties>
<property name="skipAnnotations" value="true"/>
</properties>
</rule>
<rule ref="rulesets/java/unusedcode.xml"/>
<rule ref="rulesets/java/strictexception.xml"/>
</ruleset>

到Primefaces的POM由于以下原因而失败

无法在项目primefaces上执行目标org.apache.maven.plugins:maven-pmd-plugin:3.9.0:pmd (pmd(:执行目标org.apache.maven.plugins:maven-pmd-plugin:3.9.0:pmd失败:执行org.apache.maven.plugins:maven-pmd-plugin:3.9.0:pmd:java.lang.ClassFormatError:在类文件中不是本机或抽象的方法中缺少代码属性 javax/faces/application/FacesMessage$Severity

运行时mvn validate(或mvn clean install(。

在服务器上部署 Java EE 应用程序时,有很多关于如何处理此特定错误的解释,但是这使得很难找到一种可能适用于插件执行的方法。

在插件的dependencies中添加了java.lang.ClassFormatError中建议的依赖项的任意组合:在类文件中不是本机或抽象的方法中缺少代码属性,该属性不是本机的或抽象的,这不会改变错误。

我注意到错误发生在 3.5.2 中,而不是发生在 3.3.9 中,但是我认为失败了,这可能是 Maven 错误。

我正在使用使用 PMD 7.0.0 的 maven-pmd-plugin 3.9.0。

此行为是由已在 https://github.com/pmd/pmd/issues/1131 提交的 PMD 问题引起的。

相关内容

最新更新