Skip to content

JUnit 5.10+ is required to run tests #1740

Closed

Description

@UTD-MrPeterson

After the upgrade to 0.43 this morning newly cloned repositories (several repositories from my students) will not run JUnits. The stack trace I get is:

java.lang.NoSuchMethodError: 'void org.junit.platform.commons.util.CollectionUtils.forEachInReverseOrder(java.util.List, java.util.function.Consumer)'
at org.junit.platform.launcher.core.LauncherConfigurationParameters$Builder.build(LauncherConfigurationParameters.java:143)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:129)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:112)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.(JUnit5TestLoader.java:37)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
at java.base/java.lang.Class.newInstance(Class.java:645)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:372)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:367)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:226)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

The project is configured to use JUnit 5.9.1.

Downgrading to version 0.42 resolved this error.

Already-cloned repositories continue to work normally on version 0.43, for what it's worth; it seems to be only newly-cloned ones that fail.

Activity

  1. jdneo commented on Nov 12, 2024

    @jdneo
    Member

    Hi UTD-MrPeterson Please update the junit version to 5.10+ and try again

  2. nikfalstie commented on Nov 13, 2024

    @nikfalstie

    I had the same issue and resolved it by updating the junit jupiter version. I added the following line to the build.gradle file (its a Spring project)

    ext['junit-jupiter.version'] = '5.11.3'

    PS: The problem did occur for me even though it was not a newly cloned repository.

  3. changed the title [-]Version 0.43: JUnits won't run on newly cloned repositories[/-] [+]JUnit 5.10+ is required to run tests[/+] on Nov 13, 2024
  4. jdneo commented on Nov 13, 2024

    @jdneo
    Member

    Changed title and pin the issue.

  5. circlesmiler commented on Nov 21, 2024

    @circlesmiler

    The description of Test Runner for Java tells us, that it's fine to use JUnit 5.1.0+. The change log does not tell anything about this.

    Image

    It's pretty annoying when your tests are suddenly failing with such an error and you have to debug this until finding out that somehow an update of the Test Runner Plugin maybe is the problem. (Keep in mind, that you sometimes upgrade plugins and don't see the problem immediately, but days later...)

    But I want to understand the problem:

    What is the dependency between the projects JUnit version and Test Runner for Java ? I think there is also a dependency from Test Runner for Java and the Java Language Support Plugin. Is this true?

    Or in other words: Is there something we could do to prevent this kind of error in the future? Is it somehow possible to make the JUnit version in the project independent from the plugins version? (My team member also use other IDEs... not sure if we always find "the right JUnit version" for all IDEs)

  6. jdneo commented on Nov 22, 2024

    @jdneo
    Member

    What is the dependency between the projects JUnit version and Test Runner for Java ? I think there is also a dependency from Test Runner for Java and the Java Language Support Plugin. Is this true?

    The problem is that the junit test runner embedded in this extension, which is an upstream dependency changes the requirement.

    Is there something we could do to prevent this kind of error in the future?

    If it's maven project, maybe we can just update the documents as the approach. If it's gradle, we have feature called 'Delegate test to Gradle', which will directly let gradle to run the tests, just like running thtough gradle command in terminal.

  7. 27 remaining items

  8. pcantrell commented on Aug 28, 2025

    @pcantrell

    In case anybody else runs into this issue, here’s a fix:

    Rather than pinning the JUnit dependency to a different minor version every time this plugin is updated, adding junit-platform-launcher as a project dependency appears to fix the problem.

    Here’s what the dependencies section of a build.gradle looks like after applying that fix:

    testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.+'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions