Target JDK

There is a configuration element in the PMD plugin that let you set which target JDK to use. Often you want this to be in sync with the configuration for maven-compiler-plugin. The best practice for this is to set up a property and use that in the configuration section for each of the plugins. Here is an example on how to set that up:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>${compileSource}</source>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
  <reporting>
    <plugins>
      <plugin>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.0.1</version>
        <configuration>
          <targetJdk>${compileSource}</targetJdk>
        </configuration>
      </plugin>
    </plugins>
  </reporting>
  ...
  <properties>
    <compileSource>1.5</compileSource>
  </properties>
  ...
</project>