Junit4.12报错:java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

简介: 原因 junit 4.11以上版本不再包含hamcrest jar包了,需要单独添加hamcrest-core-1.3.jar

Java报错日志



image.png

原因 junit 4.11以上版本不再包含hamcrest jar包了,需要单独添加hamcrest-core-1.3.jar


1、在pom.xml中添加


<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
<dependency>
    <groupId>org.hamcrest</groupId>
    <artifactId>hamcrest-core</artifactId>
    <version>1.3</version>
    <scope>test</scope>
</dependency>

2、手动导包


https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core/1.3


相关文章
|
Java Apache Maven
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory解决方法
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory解决方法
1343 0
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory解决方法
|
6月前
|
SpringCloudAlibaba Java Maven
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
35 2
|
Java Spring
【已解决】Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.
【已解决】Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.
3589 1
【已解决】Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.
|
6月前
|
Java
Junit4.12报错:java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
Junit4.12报错:java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
JUnit-4.12使用报java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing错误
JUnit-4.12使用报java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing错误
java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup
java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup
513 0
|
应用服务中间件
java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger 原因
WARNING: Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file
244 0
|
Java Spring
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder 问题
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder 问题
241 0
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder 问题
|
Java Apache
java.lang.NoClassDefFoundError:org/apache/commons/logging/LogFactory
java.lang.NoClassDefFoundError:org/apache/commons/logging/LogFactory
104 0