Hello,

I’m currently exploring adopting the Maven Toolchains Plugin 
(https://maven.apache.org/plugins/maven-toolchains-plugin/select-jdk-toolchain-mojo.html),
 but it seems that when using forked tests with the Maven Surefire Plugin 
(forkCount: 1, reuseForks: false) not the toolchain JDK is forked, but the JDK 
used to start Maven. This is causing my forked tests to fail, because the 
toolchain JDK is version 21 and the JDK running Maven is 17, so the forked JDK 
(17) cannot run the test which is compiled with the toolchain JDK (21). I would 
have expected the JDK for the forked tests to also be the toolchain JDK (21) in 
this scenario.

Is what I’m seeing expected behavior and is there something I can do have it 
use the toolchain JDK for the forked tests, or is this a bug and should I 
create a ticket for this?

Thanks, Nils.

Reply via email to