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

前端 未结 30 2475
盖世英雄少女心
盖世英雄少女心 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条回答
  •  清歌不尽
    2020-11-29 23:23

    As everyone informed it's IDE bug, I tried in Eclipse and STS. In both the cases, it is failing.

    As a workaround, I have fixed by modifying the pom.xml file like below.

    I have added these two maven dependencies junit-jupiter-engine and junit-platform-launcher.

    pom.xml

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

    Also please make sure to add the version of both the maven dependencies in the properties tag.

    
        1.8
        5.2.0
        1.2.0
    
    

提交回复
热议问题