1

I'm trying to add

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

with 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>

to Primefaces' POM which fails due to

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

when running mvn validate (or mvn clean install).

There's a lot of explanations how to handle this particular error when deploying Java EE applications on servers, however that makes it hard to find an approach which might work for the plugin execution.

Added any combination of dependencies suggested in java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet to the plugin's dependencies doesn't change the error.

I noticed that the error occurs with 3.5.2, but not with 3.3.9, however I see to fail how this can possibly be a Maven error.

I'm using maven-pmd-plugin 3.9.0 which uses PMD 7.0.0.

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
  • 1
    This looks like https://github.com/pmd/pmd/issues/328 which was fixed in PMD 6.0.0. Which version of PMD are you running within the maven plugin? If running Maven with `-X` you should get a complete stacktrace to submit – Johnco May 20 '18 at 02:11
  • @Johnco see answer below for the new issue link – Kalle Richter May 22 '18 at 00:57

1 Answers1

0

This behavior is caused by a PMD issue which has been filed at https://github.com/pmd/pmd/issues/1131.

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177