java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMake
在使用SpringBoot 2.2.1版本做项目时,使用单元测试的时候,环境中报的错误。但是其中有一个关键的点,就是对于plugin: interface org.mockito.plugins.MockMaker这个,这个我并没有引入,为啥还报错呢?打开External Libraries库查看,发现有相关包org.mockito:mockito-core,看来应该是Spring Boot自动引
·
在使用SpringBoot 2.2.1版本做项目时,使用单元测试的时候,环境中报的错误。
但是其中有一个关键的点,就是对于plugin: interface org.mockito.plugins.MockMaker这个,这个我并没有引入,为啥还报错呢?打开External Libraries库查看,发现有相关包org.mockito:mockito-core,看来应该是Spring Boot自动引入的mockito核心依赖项,如下
既然问题出在这里,我们取maven库中搜索mockito-core-3.1.0
相关链接
可以看到相关的依赖是1.9.10版本,而在SpringBoot自动配置的为1.10.6版本,貌似暂时不支持。
所以我们在pom文件下重新写入依赖:
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.9.10</version>
</dependency>
更多推荐
已为社区贡献1条内容
所有评论(0)