Skip to content

Commit 2fa359f

Browse files
committed
Introduce Maven toolchains.
This makes sure we use a Java 25+ JDK to comile, even though the comiled code is targeted at Java 17. Signed-off-by: Eric Bottard <eric.bottard@broadcom.com>
1 parent d5e92be commit 2fa359f

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

pom.xml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,12 @@
343343

344344
<!-- plugin versions -->
345345
<antlr.version>4.13.1</antlr.version>
346-
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
346+
<maven-compiler-plugin.version>3.14.1</maven-compiler-plugin.version>
347+
<maven-toolchains-plugin.version>3.2.0</maven-toolchains-plugin.version>
348+
<!-- The version (range) of the JDK we want to use to compile.
349+
This is different from ${java.version} which we use as -release target.
350+
This exact property name is recognized by the toolchains plugin. -->
351+
<toolchain.jdk.version>[25,)</toolchain.jdk.version>
347352
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
348353
<maven-failsafe-plugin.version>3.5.2</maven-failsafe-plugin.version>
349354
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
@@ -373,6 +378,20 @@
373378

374379
<build>
375380
<plugins>
381+
<plugin>
382+
<!-- This plugin makes sure we can locate a JDK matching the ${toolchain.jdk.version} constraint.-->
383+
<!-- It will be used by e.g. the maven.compiler.plugin, or fail otherwise. -->
384+
<groupId>org.apache.maven.plugins</groupId>
385+
<artifactId>maven-toolchains-plugin</artifactId>
386+
<version>${maven-toolchains-plugin.version}</version>
387+
<executions>
388+
<execution>
389+
<goals>
390+
<goal>select-jdk-toolchain</goal>
391+
</goals>
392+
</execution>
393+
</executions>
394+
</plugin>
376395
<plugin>
377396
<groupId>org.apache.maven.plugins</groupId>
378397
<artifactId>maven-checkstyle-plugin</artifactId>

0 commit comments

Comments
 (0)