如何解决错误 MVN 全新安装未能发布模拟除非您使用第三方模拟制造商,否则不应发生这种情况
嗨,所以我尝试通过运行 mvn clean install 来构建我的项目。理想情况下,它会成功构建,因为我的所有其他团队成员都可以做得很好。但是,它说我遇到了测试失败。这是给出的确切错误日志:
Tests run: 22,Failures: 0,Errors: 22,Skipped: 0,Time elapsed: 0.739 sec <<< FAILURE! - in com.pic.resources.xxx() Time elapsed: 0.216 sec <<< ERROR!
org.mockito.exceptions.base.MockitoException:
Failed to release mocks
This should not happen unless you are using a third-part mock maker
at com.pic.resources.xxx.java:50)
Caused by: org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: class com.pic.service.xxx.
If you're not sure why you're getting this error,please report to the mailing list.
Java : 1.8
JVM vendor name : AdoptOpenJDK
JVM vendor version : 25.242-b08
JVM name : OpenJDK 64-Bit Server VM
JVM version : 1.8.0_242-b08
JVM info : mixed mode
OS name : Mac OS X
OS version : 10.16
You are seeing this disclaimer because Mockito is configured to create inlined mocks.
You can learn about inline mocks and their limitations under item #39 of the Mockito class javadoc.
Underlying exception : org.mockito.exceptions.base.MockitoException: Could not modify all classes [class com.pic.service.xxx]
at com.pic.resources.xxx.setup(xxx.java:50)
Caused by: org.mockito.exceptions.base.MockitoException: Could not modify all classes [class com.pic.service.xxx]
at com.pic.resources.xxx.setup(xxx.java:50)
Caused by: java.lang.IllegalStateException:
Byte Buddy Could not instrument all classes within the mock's type hierarchy
This problem should never occur for javac-compiled classes. This problem has been observed for classes that are:
- Compiled by older versions of scalac
- Classes that are part of the Android distribution
at com.pic.resources.xxx.setup(xxx.java:50)
Caused by: java.lang.SecurityException: class "com.bmc.auth.OnBehalfOfAuthenticationDetailsProvider"'s signer information does not match signer information of other classes in the same package
at
我已经尝试了我能想到的所有可能的解决方案
- 将我的 JDK 更新为 11 并更改了 intellij 上的 jdk 版本并将 mvn 指向 JDK 11
- 将我的 JDK 降级到 8 并执行与 1) 相同的步骤,并使用旧版本添加了正确的字节伙伴
- 升级到最新的 maven
- 清除缓存
- 使用了最新的 mockito 版本(然后尝试了旧的 mockito 版本,但没有任何反应)
- 在 intellij 和终端中运行它没有任何改变。甚至尝试导入正确的 Intellij 设置。那没用
- 添加了 byte-buddy 依赖并使其成为最新版本
问题的唯一其他可能原因是我前几天将我的 Mac OS 升级到 Big Sur,它搞砸了我的 Java 运行时间,但我不知道这是不是一个原因。
解决方法
潜在的问题似乎是这样的:
java.lang.SecurityException: class "com.bmc.auth.OnBehalfOfAuthenticationDetailsProvider"'s signer information does not match signer information of other classes in the same package
可能的情况是,您有一个包私有类型并对 jar 进行签名,这通常不起作用,因为该类型需要放置在破坏签名的同一个包中。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。