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

后端 未结 8 1891
抹茶落季
抹茶落季 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:22

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

    This error can be come due to the version mismatch of junit-plateform-engine junit-jupiter-params and junit-platform-runner and also other respective dependencies.

    So for the resolution of this issue you do not need to define version like 1.5.3 ...etc

    you can define version as follows :

    
    
        
            org.junit.jupiter
            junit-jupiter-params
            **${junit.jupiter.version}**
            test
        
        
            org.junit.jupiter
            junit-jupiter-engine
            **${junit.jupiter.version}**
            test
        
        
            org.junit.platform
            junit-platform-runner
            **${junit.platform.version}**
            test
        
    
    

    So through this compatible version jar will be added in your project and project will run successfully

提交回复
热议问题