Last updated Jul 16, 2024

How can I change the version of Java my plugin uses

How do I specify the default Java version?

By default, Maven uses the JDK that you run it with to compile your sources. To change the default version of Java that is selected on your machine, please see the specific instructions for your platform. Check with java -version from a command line prompt.

Windows - use the Java Control Panel
Linux - use the alternatives command. More information can be found here
OSX - run Applications, Utilities, Java Preferences. Making changes to soft links by hand is error prone and can produce cryptic errors.

How do I specify a particular version of Java for my plugin?

If you would like to enforce a particular JDK version or version range, add these parameters to your plugin's POM file.


Plugins are pre-configured to use Java 1.5 as the source level when compiling. If you would like to use a different source level, you'll need to set the jdkLevel property:


This property is also used by the Maven IDEA plugin to set the source level for the project generated when you run mvn idea:idea.

Rate this page: