You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Niels Basjes <Ni...@basjes.nl> on 2022/09/02 15:41:24 UTC

[Surefire] Toolchains seem to be ignored if forkCount > 1

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

Re: [Surefire] Toolchains seem to be ignored if forkCount > 1

Posted by Niels Basjes <Ni...@basjes.nl>.
Hi Slawomir,

There is serious overlap (toolchains combined with surefire forkCount > 1 )
but I'm uncertain if this is the same problem.
I have been able to simplify my reproduction project; now it is just a
single module project with a few build plugins (without the
pluginManagement part).

Shal I submit a new issue or perhaps mention my reproduction in the
existing one you mentioned?

Niels


On Fri, Sep 2, 2022 at 6:15 PM Slawomir Jaranowski <s....@gmail.com>
wrote:

> 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 <Ni...@basjes.nl> 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
>


-- 
Best regards / Met vriendelijke groeten,

Niels Basjes

Re: [Surefire] Toolchains seem to be ignored if forkCount > 1

Posted by Slawomir Jaranowski <s....@gmail.com>.
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 <Ni...@basjes.nl> 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