测试时报Could not initialize plugin: interface org.mockito.plugins.MockMaker错误解决
mockito-core.jar现在依赖于:
byte-buddy.jar
byte-buddy-agent.jar
objenesis.jar
pom.xml添加相应依赖包:
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.8.21</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.8.21</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
<version>2.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.21.0</version>
<scope>test</scope>
</dependency>
在进行测试时遇到Mockito初始化错误,解决方法是在pom.xml中添加byte-buddy, byte-buddy-agent和objenesis的依赖,并确保mockito-core版本正确。添加如下依赖:byte-buddy.jar, byte-buddy-agent.jar, objenesis.jar和mockito-core.jar,版本分别为1.8.21和2.21.0,范围为test。
3万+

被折叠的 条评论
为什么被折叠?



