noclassdeffounderror

xytpbqjk  于 2021-07-12  发布在  Java
关注(0)|答案(0)|浏览(159)

我在有线测试中添加了hamcrest方法,在构建过程中,它成功了。
但当我试图执行测试时,它抛出了 java.lang.NoClassDefFoundError: org/hamcrest/Matchers 错误。
我尝试将hamcerst依赖项添加到包pom中,如下所示(即使父pom中已经存在该依赖项):

<dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>

但我还是一样 NoClassDefFoundError 运行时出错。为什么会这样?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题