Apache Maven Toolchains Plugin
The Toolchains Plugins enables sharing tool configuration across plugins; for example, to make sure that plugins like compiler, surefire, and javadoc all use the same JDK for execution, independently from JRE used to run Maven itself.
Goals Overview
Since version 3.2.0, a new JDK-specific toolchains mechanism is provided. This relies on an automatic JDK discovery mechanism based on an internal heuristic which tries to detect JDKs from known locations. Read about the JDK discovery mechanism for more information. This mechanism is to be used with the goal:
- toolchains:select-jdk-toolchain discover and selects a matching JDK toolchain.
Two associated helper goals are also provided:
- toolchains:display-discovered-jdk-toolchains displays discovered JDK toolchains to the console,
- toolchains:generate-jdk-toolchains-xml can be used to generate discovered JDKs in
toolchains.xml
format and let user copy/paste.
The previous toolchain
goal is still available for JDK and other types of toolchains:
- toolchains:toolchain selects a toolchain from
toolchains.xml
based on configured build requirements and stores it in build context for later retrieval by other plugins.
Usage
General instructions on how to use the Toolchains Plugin can be found on the usage page. Additionally, users can contribute to the GitHub project.
If you have questions regarding the plugin's usage, contact the user mailing list. Posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the mail archive.
If the plugin is missing a feature or has a defect, you can file a feature request or bug report in our issue tracker. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs, or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our source repository and will find supplementary information in the guide to helping with Maven.