@@ -61,23 +61,72 @@ com.sun.xml.ws:jaxws-rt:2.3.0 (implementation)
6161The source code for each of these is maintained at [ https://github.com/javaee ] ( https://github.com/javaee )
6262
6363
64+ <a name =" head3 " ></a > Selecting JDK by the Toolchains API in plugin configuration
65+ ========================
66+
67+ <configuration>
68+ [...]
69+ <jdkToolchain>
70+ <version>11</version>
71+ <vendor>sun</vendor>
72+ </jdkToolchain>
73+ [...]
74+ </configuration>
75+
76+ The above example assumes that your ** toolchains.xml** contains valid entries with these values.
77+
78+ <toolchains xmlns="http://maven.apache.org/POM/4.0.0"
79+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
80+ xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
81+ <toolchain>
82+ <type>jdk</type>
83+ <provides>
84+ <version>1.8</version>
85+ <vendor>sun</vendor>
86+ <id>jdk8</id>
87+ </provides>
88+ <configuration>
89+ <jdkHome>/path/to/openjdk8</jdkHome>
90+ </configuration>
91+ </toolchain>
92+ <toolchain>
93+ <type>jdk</type>
94+ <provides>
95+ <version>11</version>
96+ <vendor>sun</vendor>
97+ <id>jdk11</id>
98+ </provides>
99+ <configuration>
100+ <jdkHome>/path/to/openjdk/11</jdkHome>
101+ </configuration>
102+ </toolchain>
103+ </toolchains>
104+
64105
65106Java 9 in configuration of plugin
66107========================
67108
68- The plugin provides you with configuration parameter ` jvm ` which can point to path of executable Java in JDK, e.g.:
109+ The plugin provides you with configuration parameter ** jvm** which can point to the path of executable Java in JDK, e.g.:
69110
70111 <configuration>
71112 <jvm>/path/to/jdk9/bin/java</jvm>
72113 </configuration>
73114
74115Now you can run the build with tests on the top of Java 9.
75116
117+ This is highly unrecommended configuration due to the fact that this solution is directly specifying the path
118+ with the JDK and thus it is not smoothly transferable to another build systems.
119+
76120
77121Maven Toolchains with JDK 9
78122========================
79123
80- This is an example on Windows to run unit tests with custom path to Toolchain ** (-t ...)** .
124+ Since the version ** 3.0.0-M5** you can use the standard way to switch the JDK within the execution of the plugin.
125+ For more information see the [ chapter 'Selecting JDK by the Toolchains API in plugin configuration'] ( #head3 ) .
126+
127+
128+ The plugin ** maven-toolchains-plugin** should be used along with old versions of Surefire or Failsafe plugin.
129+ In this example you can see how to switch the JDK by Toolchain ** (-t ...)** in the entire build (on Windows).
81130
82131 $ mvn -t D:\.m2\toolchains.xml test
83132
0 commit comments