Hi Niels, This issue can be similar to your: https://issues.apache.org/jira/browse/SUREFIRE-2073
pt., 2 wrz 2022 o 17:41 Niels Basjes <[email protected]> napisał(a): > Hi, > > I was working on a project and ran into a problem. > I have reduced the reproduction to the smallest I could: > > https://github.com/nielsbasjes/MavenSurefireForkCount > > Summary: > - I use Ubuntu 20.04 > - I have Java 11 as the default (i.e. in path and JAVA_HOME). > - I also have Java 8 and Java 17 installed which I use via toolchains. > - I have both the compiler and surefire plugins configured via > pluginManagement ("large" project trying to avoid duplicating the > configurations). > - A specific module in my project can only run on Java 17 because of a > dependency. > > When I build and test the project it works fine. > When I try to run the surefire plugin with a forkCount > 1 it fails over > binary class versions: It tries to run the Java 17 class file using the > Java 11 runtime which obviously won't work. > > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test (default-test) > on project toolchainer: Execution default-test of goal > org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test failed: > java.lang.UnsupportedClassVersionError: nl/basjes/bugreport/TestApp has > been compiled by a more recent version of the Java Runtime (class file > version 61.0), this version of the Java Runtime only recognizes class file > versions up to 55.0 -> [Help 1] > > What am I doing wrong? > Or should I submit this as a bugreport? > > -- > Best regards / Met vriendelijke groeten, > > Niels Basjes > -- Sławomir Jaranowski
