Junit版本过高导致的错误:Exception in thread "main" java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribin

如果单元测试适用的junit的版本是4.8或4.9,则不会报这个下面错误:     报这个错误的原因是junit版本高于4.11,而在4.11及以上的依赖包中,是没有hamcrest的依赖包。 因此解决方法有两种:要么换低版本的junit包,要么则需要再加入hamcrest的依赖。 maven中的依赖如下: <dependency>     <groupId>org.hamcrest</group
相关文章
相关标签/搜索