NoSuchMethodError with Hamcrest 1.3 & JUnit 4.11

前端 未结 8 1379
独厮守ぢ
独厮守ぢ 2020-12-30 19:03

Another instance of the NoSuchMethodError for the JUnit & Hamcrest combination. Offending code:

assertThat(dirReader.document(0).getFields()         


        
8条回答
  •  抹茶落季
    2020-12-30 19:38

    I solved this jar hell problem in my Gradle project with the code below:

        testCompile (group: 'junit', name: 'junit', version: '4+') {
            exclude group: 'org.hamcrest'
        }
        testCompile ('org.mockito:mockito-core:1+') {
            exclude group: 'org.hamcrest'
        }
        testCompile 'org.hamcrest:java-hamcrest:2.0.0.0'
    

提交回复
热议问题