It should be fixed in 2.22.2 which is the version we’re now using. It’s also no longer relevant on master following the move to Gradle.
See https://github.com/spring-projects/spring-boot/issues/17517 and https://github.com/spring-projects/spring-boot/issues/17524, the changes for which we may just be able to revert.
Comment From: dreis2211
@wilkinsona Isn't the fix only in 2.22.3, which is not released yet?
Comment From: wilkinsona
Thanks, @dreis2211. Looks like it. Not sure from where I got the impression it was fixed in a released version. Wishful thinking, perhaps!
Comment From: snicoll
Surefire 2.22.3 has been staged so I'll run the build with that version without the workaround.
Comment From: snicoll
I think I've reverted both of these commits in https://github.com/snicoll/spring-boot/commit/78d16d8c8b861e73a0be4eaaab4d57983b3ff5f3 but I don't seem to reproduce the problem building spring-boot-test-autoconfigure
. Wondering what I've missed as I'd like to reproduce the problem before upgrading to the Surefire staged release.
Comment From: dreis2211
It was only relevant when running tests via surefire when all modules were build I think, because the bug polluted things across modules.
Comment From: snicoll
Thanks for reminding me Christoph. I'll try that
Comment From: snicoll
So I indeed had the issue with a full build with 2.22.2
. I upgraded to the stage release and I got a different exception on the same module
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.3:test (default-test) on project spring-boot-configuration-metadata: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/snicoll/workspace/work/spring-boot/2.2.x/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] There was an error in the forked process
[ERROR] java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineDiscoveryListener
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineDiscoveryListener
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:656)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1186)
Comment From: sormuras
Smells like a version mix of various JUnit Platform artifacts. Possible sources of those mixes are ... numerous.
Just in case: https://stackoverflow.com/a/54605523/1431016
Comment From: snicoll
Just in case
This is reproduced in the Spring Boot build (link above) and there's no override of JUnit there to begin with.
Comment From: sormuras
Thinking out aloud: 2.22.3 ships with JUnit Platform 1.6.1 (emitting better error messages when there's a version mix) -- which version does Spring Boot supply/expect/use?
Comment From: snicoll
which version does Spring Boot supply/expect/use?
That SB version is using 5.5.2 but doesn't expect anything. It's just the runtime that is managed, we don't do anything fancy with JUnit ourselves. It looks like Surefire does though for some reason as if I override to JUnit 5.6.2 then the build passes.
So it looks the other fixed issue in that release is breaking us as JUnit platform 1.6.1 is now mandatory? That can't be right surely as it means you can't run your build with an older JUnit release now.
Comment From: sbrannen
So it looks the other fixed issue in that release is breaking us as JUnit platform 1.6.1 is now mandatory? That can't be right surely as it means you can't run your build with an older JUnit release now.
Indeed. Sounds like something broken in Surefire.
Comment From: dreis2211
I wonder if we should simply target this one to 2.3.x+/master only and leave things as they are in earlier branches since the move to Gradle obsoleted the Surefire stuff anyhow.
Comment From: snicoll
The change I've discovered goes way beyond Spring Boot as far as I can see so I'd like to hear from the surefire team first.
Comment From: snicoll
That one has run its course, let's supersede it in favor of #26632. Thanks Christoph!