Java 6 in Plugins and Shared Components

When you want to start using Java 6 features in a plugin, or a shared component, the process described here must be used as decided by the Maven PMC.

A plugin/component can start using Java 6 features and/or dependencies when the need arises. If there are issues that have already been fixed, but not yet released, the current trunk of the plugin/component must be released first, targeting Java 5. In the announcement for such a final Java 5 version of the plugin/component, we inform the users that this is the last version that will work with Java 5.

In JIRA

When a plugin/component decides to switch to Java 6, you should set the description field for the versions in JIRA for the plugin/component, so that it is clear which version works with which version of Java. Mark the last Java 5 compatible version with "Last version to work with Java 5", see example. Mark the first version that requires Java 6 "This version requires Java 6", see example.

Create an issue "Require Java 6" and schedule it for the first Java 6 version, see example. Reference this issue when you check in the code changes (see below) into version control

On the plugin/component site

Specify the Java requirements in index.apt.vm: "This plugin/component requires Java ${javaVersion}.", see example. We need to use the variable ${javaVersion} here, because ${maven.compiler.source} does not work in a site.

In the POM

Make sure these 3 properties are defined, either in the project or in a parent:

  • javaVersion=1.6
  • maven.compiler.source=${javaVersion}
  • maven.compiler.target=${javaVersion}

Here is a list plugins that are defined in a parent, and that already makes use of the above mentioned properties. So it should be enough to just make sure that the effective-pom looks ok.

  • maven-compiler-plugin is defined in maven-parent, see example
  • maven-enforcer-plugin and the enforceBytecodeVersion rule is defined in maven-parent, see example
  • maven-pmd-plugin is defined in maven-parent, see example

These plugins that are not defined in a parent, so you might need to configure the Java version for them in the plugin/component