MavenToolchains

This is a reference for the Maven Toolchains descriptor.

The default location for the toolchains file is ~/.m2/toolchains.xml

A Toolchain is a preconfigured object that Maven plugins can use for tool configuration retrieval (location and other information).

The toolchains-plugin can read available toolchains on the user's computer and match them against the toolchain requirements of the project (as configured in pom.xml): if match is found, the toolchain instance is made available to other Maven plugins.

With jdk toolchain, for example, instead of being stuck with the JDK used to run Maven, all plugins can use the same other JDK instance without hardcoding absolute paths into the pom.xml and without configuring every plugin that require path to JDK tools.

See the Guide to Using Toolchains for more information.

<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.0.0 http://maven.apache.org/xsd/toolchains-1.0.0.xsd">
  <toolchain>
    <type/>
    <provides/>
    <configuration/>
  </toolchain>
</toolchains>

toolchains

The <toolchains> element is the root of the descriptor. The following table lists all of the possible child elements.

Element Type Description
toolchain* List<ToolchainModel> (Many) The toolchain instance definition.

toolchain

Definition of a toolchain instance.

Element Type Description
type String Type of toolchain:
provides DOM

Toolchain identification information, which will be matched against project requirements.

Actual content structure is completely open: each toochain type will define its own format and semantics.

In general, this is a properties format: <name>value</name> with predefined properties names.

configuration DOM

Toolchain configuration information, like location or any information that is to be retrieved.

Actual content structure is completely open: each toochain type will define its own format and semantics.

In general, this is a properties format: <name>value</name> wih predefined properties names.