Brief examples on how to use the toolchains plugin.

Generic Plugin configuration information

See the following links for information about including and configuring plugins in your project:

What is a toolchain?

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 (as configured in toolchains.xml) 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.

The toolchains:toolchain mojo

This goal is meant to be bound to a lifecycle phase and configured in your pom.xml. In order to function properly, it shall be the first phase in the lifecycle, eg. the "validate" phase, which is the default if you don't configure execution phase.

The available standard toolchains are described here.