java.lang.NoClassDefFoundError: org/junit/platform/commons/PreconditionViolationException when trying run junit5 test with maven

后端 未结 8 1895
抹茶落季
抹茶落季 2020-12-10 00:56

When trying to run tests using command mvn test I receive an error:

[ERROR] There was an error in the forked process
[ERROR] java.lang.NoClassDefFou         


        
8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-10 01:32

    I have commented the below part in pom.xml:

      
          org.junit.jupiter
          junit-jupiter-api
          5.3.2
          test
        
        
          org.junit.jupiter
          junit-jupiter-engine
          5.3.2
          test
        
    

    And I have added junit5 in java build path(project(right click->java build path->libraries->junit->junit5) It worked for me. Mine is spring-boot project.

提交回复
热议问题