Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory

前端 未结 30 2452
盖世英雄少女心
盖世英雄少女心 2020-11-29 22:31

The problem

Whenever I run my projects JUnit test (using JUnit 5 with Java 9 and Eclipse Oxygen 1.a) I encounter the problem that eclipse can\'t find any tests.

30条回答
  •  萌比男神i
    2020-11-29 23:13

    Using STS 3.9.1 I got the same problem. However, currently I do not require any new JUnit5 features, so I tried to force using an older version. If using maven, you can add following dependencies to your pom.xml:

    
        org.junit.platform
        junit-platform-launcher
        ${junit.platform.version}
        test
    
    
    
        org.junit.jupiter
        junit-jupiter-engine
        ${junit.jupiter.version}
        test
    
    
    
        org.junit.vintage
        junit-vintage-engine
        ${junit.vintage.version}
        test
    
    

    This did the trick for me (at least as long as I do not need JUnit5 explicitly).

提交回复
热议问题