toolchains:select-jdk-toolchain

Full name:

org.apache.maven.plugins:maven-toolchains-plugin:3.2.0:select-jdk-toolchain

Description:

Discover JDK toolchains and select a matching one.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is not marked as thread-safe and thus does not support parallel builds.
  • Since version: 3.2.0.
  • Binds by default to the lifecycle phase: validate.

Optional Parameters

Name Type Since Description
<comparator> String - Comparator used to sort JDK toolchains for selection. This property is a comma separated list of values which may contains:
  • lts: prefer JDK with LTS version
  • current: prefer the current JDK
  • env: prefer JDKs defined using JAVA\{xx\_HOME} environment variables
  • version: prefer JDK with higher versions
  • vendor: order JDK by vendor name (usually as a last comparator to ensure a stable order)

Default: lts,current,env,version,vendor
User Property: toolchain.jdk.comparator
<discoverToolchains> boolean - Automatically discover JDK toolchains using the built-in heuristic. The default value is true.
Default: true
User Property: toolchain.jdk.discover
<env> String - The env constraint for the JDK toolchain to select. To match the constraint, an environment variable with the given name must point to the JDK. For example, if you define JAVA11_HOME=~/jdks/my-jdk-11.0.1, you can specify env=JAVA11_HOME to match the given JDK.
User Property: toolchain.jdk.env
<runtimeName> String - The runtime name constraint for the JDK toolchain to select.
User Property: toolchain.jdk.runtime.name
<runtimeVersion> String - The runtime version constraint for the JDK toolchain to select.
User Property: toolchain.jdk.runtime.version
<useJdk> SelectJdkToolchainMojo$JdkMode - The matching mode, either IfMatch (the default), IfSame, or Never. If IfMatch is used, a toolchain will not be selected if the running JDK does match the provided constraints. This is the default and provides better performances as it avoids forking a different process when it's not required. The IfSame avoids selecting a toolchain if the toolchain selected is exactly the same as the running JDK. THe Never option will always select the toolchain.
Default: IfMatch
User Property: toolchain.jdk.mode
<vendor> String - The vendor constraint for the JDK toolchain to select.
User Property: toolchain.jdk.vendor
<version> String - The version constraint for the JDK toolchain to select.
User Property: toolchain.jdk.version

Parameter Details

<comparator>

Comparator used to sort JDK toolchains for selection. This property is a comma separated list of values which may contains:
  • lts: prefer JDK with LTS version
  • current: prefer the current JDK
  • env: prefer JDKs defined using JAVA\{xx\_HOME} environment variables
  • version: prefer JDK with higher versions
  • vendor: order JDK by vendor name (usually as a last comparator to ensure a stable order)
  • Type: java.lang.String
  • Required: No
  • User Property: toolchain.jdk.comparator
  • Default: lts,current,env,version,vendor

<discoverToolchains>

Automatically discover JDK toolchains using the built-in heuristic. The default value is true.
  • Type: boolean
  • Required: No
  • User Property: toolchain.jdk.discover
  • Default: true

<env>

The env constraint for the JDK toolchain to select. To match the constraint, an environment variable with the given name must point to the JDK. For example, if you define JAVA11_HOME=~/jdks/my-jdk-11.0.1, you can specify env=JAVA11_HOME to match the given JDK.
  • Type: java.lang.String
  • Required: No
  • User Property: toolchain.jdk.env

<runtimeName>

The runtime name constraint for the JDK toolchain to select.
  • Type: java.lang.String
  • Required: No
  • User Property: toolchain.jdk.runtime.name

<runtimeVersion>

The runtime version constraint for the JDK toolchain to select.
  • Type: java.lang.String
  • Required: No
  • User Property: toolchain.jdk.runtime.version

<useJdk>

The matching mode, either IfMatch (the default), IfSame, or Never. If IfMatch is used, a toolchain will not be selected if the running JDK does match the provided constraints. This is the default and provides better performances as it avoids forking a different process when it's not required. The IfSame avoids selecting a toolchain if the toolchain selected is exactly the same as the running JDK. THe Never option will always select the toolchain.

<vendor>

The vendor constraint for the JDK toolchain to select.
  • Type: java.lang.String
  • Required: No
  • User Property: toolchain.jdk.vendor

<version>

The version constraint for the JDK toolchain to select.
  • Type: java.lang.String
  • Required: No
  • User Property: toolchain.jdk.version