Apache

Docs

Java versions and toolchains

Compile for an older Java, or build with a different JDK than the one Maven runs on.

  • Toolchains explainedWhy Maven keeps the JDK it runs on apart from the JDK that compiles and tests your code, how plugins find that JDK, and how it differs from release.
  • Build with another JDKCompile, test and package a project with a JDK of your choice while Maven itself keeps running on the JDK in JAVA_HOME.
  • Compile for an older Java versionBuild classes that run on an older Java than the JDK you build with, check them against that Java's API, and run the tests on it.
  • Target a Java versionSet release, or source and target, so the compiler produces classes for the Java version you support, and what each option checks.
  • Build multi-release JARsShip classes for several Java versions in one JAR, and the four ways to build one with Maven.
  • toolchains.xml referenceWhere Maven reads toolchains.xml, the elements of a JDK toolchain, how a requirement matches an entry, and which plugins use the selected toolchain.