@@ -61,23 +61,72 @@ com.sun.xml.ws:jaxws-rt:2.3.0 (implementation)
61
61
The source code for each of these is maintained at [ https://github.com/javaee ] ( https://github.com/javaee )
62
62
63
63
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
+
64
105
65
106
Java 9 in configuration of plugin
66
107
========================
67
108
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.:
69
110
70
111
<configuration>
71
112
<jvm>/path/to/jdk9/bin/java</jvm>
72
113
</configuration>
73
114
74
115
Now you can run the build with tests on the top of Java 9.
75
116
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
+
76
120
77
121
Maven Toolchains with JDK 9
78
122
========================
79
123
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).
81
130
82
131
$ mvn -t D:\.m2\toolchains.xml test
83
132
0 commit comments