模拟服务器与 google 番石榴的最新版本不兼容

mockserver not compatible with the last version of google guava

目前我使用 mockServer 来模拟 Java 中的所有外部服务。当我启动 mockServer 时:

mockServer = startClientAndServer(1080);
proxy = StartClientAndProxy(1090);

我收到了

NoSuchMethodError: com.google.common.collect.Sets.newConcurrentHashSet().

经过一些研究,我认为错误的发生是因为 google 番石榴库的最新版本,更准确地说,不再存在的函数 com.google.common.collect.Sets.newConcurrentHashSet() 是最新版本的番石榴

不幸的是,我有另一个库需要最新版本的番石榴。

您会推荐什么来解决这个问题?

在我看来 Sets.newConcurrentHashSet() pretty much still exists in the latest snapshot version of Guava. It was added in Release 15. MockServer requires Guava 18

我的猜测是您在类路径上有来自 另一个 依赖项的旧版本的 Guava。找出哪一个并进行调整。