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
相關文章
相關標籤/搜索