Upgrading PMD at Runtime

The Maven PMD plugin comes with a default PMD version: for maven-pmd-plugin 3.21.2, PMD 6.55.0 is used by default.

Given that the newer PMD version is compatible, you can override the PMD version, that the Maven plugin will use and benefit from the latest bugfixes and enhancements:

<project>
  <properties>
    <pmdVersion>...choose your version...</pmdVersion>
  </properties>
...
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>3.21.2</version>
          <dependencies>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-core</artifactId>
              <version>${pmdVersion}</version>
            </dependency>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-java</artifactId>
              <version>${pmdVersion}</version>
            </dependency>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-javascript</artifactId>
              <version>${pmdVersion}</version>
            </dependency>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-jsp</artifactId>
              <version>${pmdVersion}</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
...
</project>

Version relationship between maven-pmd-plugin and PMD

Every maven-pmd-plugin version ships with a default PMD version. The default PMD version is upgraded irregularly, e.g. when support for a newer Java version is required.

Here's a historical overview about the default PMD version used:

maven-pmd-plugin PMD
3.21.0 6.55.0
3.20.0 6.53.0
3.19.0 6.49.0
3.18.0 6.48.0
3.17.0 6.46.0
3.16.0 6.42.0
3.15.0 6.38.0
3.14.0 6.29.0
3.13.0 6.21.0
3.12.0 6.13.0
3.11.0 6.8.0
3.10.0 6.4.0
3.9.0 6.0.1
3.8 5.6.1
3.7 5.5.1
3.6 5.3.5
3.5 5.3.2