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.
This behavior is caused by a PMD issue which has been filed at https://github.com/pmd/pmd/issues/1131.