首页 > 解决方案 > 错误 :: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V

问题描述

我收到此错误是因为我有 ValidationFramework.jar,其中包含与 Google Cloud Platform Libraries 相同的类,即 com.google.common.base.Preconditions.checkState() 并且 eclipse 正在为我的 java 应用程序选择 ValidationFramework 中的类。

谁能告诉我如何让eclipse为我的java服务选择谷歌云平台库?

标签: javaeclipsegoogle-cloud-platformjar

解决方案


很可能您的依赖项之一使用旧番石榴。com.google.common.base.Preconditions类在 Guava 库 ( com.google.guava:guava) 中。您的类路径中有一个意外的 Guava 版本。如果您可以分享您的 pom.xml 或 build.gradle,我可以进一步检查。


推荐阅读