Skip to content

NoClassDefFoundError when running JUnit5 tests #971

Closed

Description

Since 0.22.3 the tests don't work anymore when using

testImplementation 'org.junit.jupiter:junit-jupiter:5.5.0'

in my build.gradle file.
It generates the following error:

java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineDiscoveryListener

it works again when I downgrade to 0.22.2, I guess it might be related to #970 but I'm not sure.

I also tried to change the testImplementation line to 'org.junit.jupiter:junit-jupiter:5.6.0' and now it works with the 0.22.3 version.

The problem I have is that it's a big project and I can't change the testImplementation line just because I have a problem with an IDE extension.

Activity

  1. jdneo commented on Apr 6, 2020

    @jdneo
    Member

    I can also reproduce this bug in Eclipse 2020-03.

    I've created a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=561797

    Update: It turns out that it's a bug for buildship: eclipse-buildship/buildship#980

  2. changed the title [-]Last version 0.22.3 generates an error when running tests[/-] [+]NoClassDefFoundError when running JUnit5 tests[/+] on Apr 7, 2020
  3. jdneo commented on Apr 16, 2020

    @jdneo
    Member

    Below are several workarounds before the upstream fixed this issue:

    • Upgrade the org.junit.jupiter:junit-jupiter to 5.6.0
    • Adding testImplementation('org.junit.platform:junit-platform-launcher:1.5.2')
    • Downgrade the extension to 0.22.2

    You can choose one of the above three to workaround the issue.

  4. norricorp commented on Apr 23, 2020

    @norricorp

    I downgraded java test runner from 0.22.3 to 0.22.2. Still get same problem
    java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineDiscoveryListener
    when running test.
    Compiles and runs on command line (a test does fail so would like to debug)

  5. csuzdy commented on May 5, 2020

    @csuzdy

    Downgrading the extension to 0.22.2 didn't help, but adding testImplementation('org.junit.platform:junit-platform-launcher:1.5.2') fixed the issue.

  6. pnhung commented on May 19, 2020

    @pnhung

    Even downgrade the extension or upgrade jupiter version not help, just add [testImplementation 'org.junit.platform:junit-platform-launcher:1.5.2'] and version MUST 1.5.2, 1.7.0 not work too

  7. kingthorin commented on May 24, 2020

    @kingthorin

    Upgrade the org.junit.jupiter:junit-jupiter to 5.6.0

    Worked for us.

  8. PyvesB commented on Jul 31, 2020

    @PyvesB

    Upgrade the org.junit.jupiter:junit-jupiter to 5.6.0

    Worked for us as well in a Maven project.

    Make sure that there aren't any dependencies in your dependency tree that are transitively causing some of the JUnit versions to be lowered. For example, having both spring-boot-starter-test and junit-jupiter can cause situations like the following, where the main JUnit libraries are on 5.6.2, but the JUnit platform engine is on 1.5.2 instead of 1.6.2:
    Screenshot 2020-07-31 at 16 07 41

  9. kim-daeyong commented on Oct 29, 2020

    @kim-daeyong

    Even downgrade the extension or upgrade jupiter version not help, just add [testImplementation 'org.junit.platform:junit-platform-launcher:1.5.2'] and version MUST 1.5.2, 1.7.0 not work too

    it work! thanks

  10. MKruschke commented on Feb 24, 2021

    @MKruschke

    Adding testImplementation('org.junit.platform:junit-platform-launcher:1.5.2')

    worked for me 👍🏻

  11. maciej-salamon-ftm commented on Mar 19, 2021

    @maciej-salamon-ftm

    junit-platform-launcher:1.7.1 seems to work fine now

  12. jdneo commented on Oct 20, 2021

    @jdneo
    Member

    Close this one since it's out of the extension's scope. Please refer to eclipse-buildship/buildship#980 (comment) for a solution. Thanks!

  13. manojboot commented on Feb 21, 2023

    @manojboot

    testImplementation('org.junit.platform:junit-platform-launcher:1.5.2')
    adding this worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions