I guess this was already been reported as 
https://issues.apache.org/jira/browse/SUREFIRE-1942 (fork ignores toolchain 
higher than system) in 2021?
Nils.

> Op 3 jan 2025, om 19:47 heeft Nils Breunese <n...@breun.nl> het volgende 
> geschreven:
> 
> Thanks for confirming. Should I create a Surefire issue for this?
> 
> Nils.
> 
>> Op 3 jan 2025 om 18:51 heeft Piotr Żygieło <piotr.zygi...@gmail.com> het 
>> volgende geschreven:
>> 
>> On Fri, 3 Jan 2025 at 15:41, Nils Breunese <n...@breun.nl> wrote:
>>> Thanks for the pointer,
>> 
>> That was not good at all (see below).
>> 
>>> It seems that using <jdkToolchain> in the configuration of the execution 
>>> for the forked tests requires a local global toolchains.xml
>> 
>> I am observing something similar.
>> 
>>> toolchains:select-jdk-toolchain can auto-detect JDK toolchains
>> 
>> If I *ignore* the link I posted myself, and :select-jdk-toolchain -
>> selected JDK is used as expected across plugins - compiler, surefire,
>> jar etc. So for example starting maven with JDK 11, selecting JDK21 -
>> and compiling for release 21 and then surefire-ing it (w/o any
>> toolchain-related m-surefire-p configuration) - works.
>> 
>> But surefire breaks - as you described - with forking, once
>> _reuseForks=false_ or _forkCount=2_ is set.
>> 
>> Which is very unsatisfactory, as this is logged:
>> 
>> [INFO] --- surefire:3.5.0:test (default-test) @ ... ---
>> [INFO] Toolchain in maven-surefire-plugin:
>> JDK[/usr/lib/jvm/java-21-openjdk-21.0.5.0.11-1.fc40.x86_64]
>> 
>> and then
>> 
>> java.lang.UnsupportedClassVersionError: ... has been compiled by a
>> more recent version of the Java Runtime (class file version 65.0),
>> this version of the Java Runtime only recognizes class file versions
>> up to 55.0
>> 
>> --
>> Piotrek
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to