且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Hamcrest 1.3&的NoSuchMethodError JUnit 4.11

更新时间:2023-11-19 23:27:16

此博客为我解决了同样的问题:

This blog helped fix the same problem for me:

https://tedvinke .wordpress.com/2013/12/17/mixing-junit-hamcrest-and-mockito-explaining-nosuchmethoderror/

在Mockito和Junit的依赖项中,作者添加了排除项:

Inside the dependencies for Mockito and Junit, the author added excludes:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
    <exclusions>
        <exclusion>
            <artifactId>hamcrest-core</artifactId>
            <groupId>org.hamcrest</groupId>
        </exclusion>
    </exclusions>
</dependency>