This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-site.git
The following commit(s) were added to refs/heads/master by this push: new d2fb2db0 Edit and update (#494) d2fb2db0 is described below commit d2fb2db03fdb4511be68cfaab1a5538803738cc8 Author: Elliotte Rusty Harold <elh...@users.noreply.github.com> AuthorDate: Mon Feb 26 07:22:48 2024 -0500 Edit and update (#494) Java 5 is a little old, and sun is defunct. @hboutemy --- content/apt/guides/mini/guide-using-toolchains.apt | 48 +++++++++++----------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/content/apt/guides/mini/guide-using-toolchains.apt b/content/apt/guides/mini/guide-using-toolchains.apt index 10fb4025..26bde31e 100644 --- a/content/apt/guides/mini/guide-using-toolchains.apt +++ b/content/apt/guides/mini/guide-using-toolchains.apt @@ -31,15 +31,13 @@ Guide to Using Toolchains -* What is Toolchains? +* What are Toolchains? - Maven Toolchains provide a way for plugins to discover what JDK (or other tools) are to be used during the build, - without the need to configure them in each plugin nor in every <<<pom.xml>>>, or forcing a precise location among every - machine building the project. + Maven Toolchains provide a way for a project to specify the JDK (or other tools) + used to build the project, without needing to configure this in each plugin or in every <<<pom.xml>>>. - With Maven Toolchains applied to JDK toolchain, a project can be built using a specific version of JDK independent - from the one Maven is running with. Think how JDK versions can be set in IDEs like IDEA, NetBeans and Eclipse, or how you can - compile with an older JDK from Maven running with a recent one. + When Maven Toolchains are used to specify the JDK, a project can be built by a specific version of the JDK independent + of the one Maven is running with. This is similar to how JDK versions can be set in IDEs like IDEA, NetBeans and Eclipse. ** Prerequisites @@ -111,8 +109,8 @@ Guide to Using Toolchains <configuration> <toolchains> <jdk> - <version>1.5</version> - <vendor>sun</vendor> + <version>1.8</version> + <vendor>openjdk</vendor> </jdk> </toolchains> </configuration> @@ -121,20 +119,20 @@ Guide to Using Toolchains </plugins> +-----+ - As you can see in the example above, a JDK toolchain with <<<\<version\>>>> "1.5" and <<<\<vendor\>>>> "sun" is to be used. Now how + As you can see in the example above, a JDK toolchain with <<<\<version\>>>> "1.8" and <<<\<vendor\>>>> "openjdk" is to be used. Now how does the plugin know where this JDK is installed? This is where the <<<toolchains.xml>>> file comes in. The <<<toolchains.xml>>> file (see below) is the configuration file where you set the installation paths of your toolchains. - This file should be put in your <<<$\{user.home\}/.m2>>> directory. When the <<<maven-toolchains-plugin>>> executes, it looks for the <<<toolchains.xml>>> file, - reads it and looks for a toolchain matching the toolchains requirements configured in the plugin. In our example, that would be a JDK toolchain with - <<<\<version\>>>> "1.5" and <<<\<vendor\>>>> "sun". Once a match is found, - the plugin then stores the toolchain to be used in the MavenSession. As you can see in our <<<toolchains.xml>>> below, there is indeed a JDK - toolchain with <<<\<version\>>>> "1.5" and <<<\<vendor\>>>> "sun" configured. So when the <<<maven-compiler-plugin>>> we've - configured in our <<<pom.xml>>> above executes, it will see that a JDK toolchain is set in the MavenSession and will thereby use - that toolchain (that would be the JDK installed at <<</path/to/jdk/1.5>>> for our example) to compile the sources. + This file should be put in the <<<$\{user.home\}/.m2>>> directory. When the <<<maven-toolchains-plugin>>> executes, it looks for the <<<toolchains.xml>>> file, + reads it and looks for a toolchain matching the toolchains requirements configured in the plugin. In this example, that is a JDK toolchain with + <<<\<version\>>>> "1.8" and <<<\<vendor\>>>> "openjdk". Once a match is found, + the plugin then stores the toolchain to be used in the MavenSession. As you can see in the <<<toolchains.xml>>> below, there is indeed a JDK + toolchain with <<<\<version\>>>> "1.8" and <<<\<vendor\>>>> "openjdk" configured. So when the <<<maven-compiler-plugin>>> + configured in the <<<pom.xml>>> above executes, it sees that a JDK toolchain is set in the MavenSession and will use + that toolchain (that would be the JDK installed at <<</path/to/jdk/1.8>>> in this example) to compile the sources. Starting with {{{/docs/3.3.1/release-notes.html}Maven 3.3.1}} you can put the <<<toolchains.xml>>> - file wherever you like by using the <<<--global-toolchains file>>> option but it is recommended to + file wherever you like by using the <<<--global-toolchains file>>> option, but it is recommended to locate it into <<<$\{user.home\}/.m2/>>>. @@ -145,21 +143,21 @@ Guide to Using Toolchains <toolchain> <type>jdk</type> <provides> - <version>1.5</version> - <vendor>sun</vendor> + <version>1.8</version> + <vendor>openjdk</vendor> </provides> <configuration> - <jdkHome>/path/to/jdk/1.5</jdkHome> + <jdkHome>/path/to/jdk/1.8</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> - <version>1.6</version> - <vendor>sun</vendor> + <version>17</version> + <vendor>azul</vendor> </provides> <configuration> - <jdkHome>/path/to/jdk/1.6</jdkHome> + <jdkHome>/path/to/jdk/17</jdkHome> </configuration> </toolchain> @@ -176,4 +174,4 @@ Guide to Using Toolchains </toolchains> +-----+ - Note that you can configure as many toolchains as you want in your <<<toolchains.xml>>> file. + You can configure as many toolchains as you want in your <<<toolchains.xml>>> file.