Menu

Error Running PMD on Java 8

Abhijith P
2014-11-03
2014-11-05
  • Abhijith P

    Abhijith P - 2014-11-03

    Hi,

    I am trying to use latest version of PMD 5.2.0 release on my Java project which used jdk 1.8. We are using Maven, hence I used maven-pmd-plugin:3.2 version to run pmd check.

    PMD configuration is given below

                    <plugin> 
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-pmd-plugin</artifactId>
                        <version>3.2</version>
                        <configuration>
                            <targetJdk>1.8</targetJdk>
                            <!-- Minimum Priority = 5 Maximum Priority = 0 -->
                            <failurePriority>2</failurePriority>
                            <verbose>true</verbose>
                            <rulesets>
                                <ruleset>custom.pmd.rulesets.xml</ruleset>
                            </rulesets>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>net.sourceforge.pmd</groupId>
                                <artifactId>pmd-core</artifactId>
                                <version>5.2.0</version>
                            </dependency>
                            <dependency>
                                <groupId>net.sourceforge.pmd</groupId>
                                <artifactId>pmd-java</artifactId>
                                <version>5.2.0</version>
                            </dependency>
                        </dependencies>
                    </plugin>
    

    I am getting below error during the build

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.2:pmd (pmd) on project copula-record: Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.2:pmd failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-pmd-plugin:3.2:pmd: java.lang.NoSuchMethodError: net.sourceforge.pmd.lang.LanguageVersion.findByTerseName(Ljava/lang/String;)Lnet/sourceforge/pmd/lang/LanguageVersion;

    Has anybody else encountered this and knows resolution? Thanks

     
  • Andreas Dangel

    Andreas Dangel - 2014-11-05

    Upgrading the maven-pmd-plugin to PMD 5.2.x is unfortunately not so easy - it needs additionally to the dependencies some code changes.
    But it will happen hopefully soon.

    See also: http://jira.codehaus.org/browse/MPMD-191 and https://github.com/apache/maven-plugins/pull/30

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.