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

maven-pmd-plugin execution fails due to "Absent Code attribute in method that is not native or abstract in class file"

我正在尝试添加

<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 由于

而失败

Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.9.0:pmd (pmd) on project primefaces: Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.9.0:pmd failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-pmd-plugin:3.9.0:pmd: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/application/FacesMessage$Severity

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

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

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet 中建议的任何依赖项组合添加到插件的 dependencies 不会更改错误。

我注意到错误出现在 3.5.2 中,但不是出现在 3.3.9 中,但是我发现失败了,这怎么可能是 Maven 错误。

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

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