admin管理员组文章数量:1568331
Description:
An attempt was made to call the method com.googlemon.collect.FluentIterable.append(Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable; but it does not exist. Its class, com.googlemon.collect.FluentIterable, is available from the following locations:
jar:file:/C:/Users/XXX/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar!/com/google/common/collect/FluentIterable.class
It was loaded from the following location:
file:/C:/Users/XXX/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.googlemon.collect.FluentIterable
背景:
在rabbon工程中加入swagger引发的错误。
环境:
spring-cloud-starter-netflix-ribbon Greenwich.RC2
swagger-spring-boot-starter 1.8.0.RELEASE
排查:
打开pom.xml文件,切换到dependency hierarchy
左侧为各jar包之间的关系视图,右侧为决定jar包版本的视图
在右侧找出报错的jar包名称,单击,左侧用到的会自动高亮,
然后我这边是因为swagger的guava.jar用到了20,决定性版本为16.0.1,不兼容所以出错了
如下图
解决方案1:统一版本
就是为jar包指定一个版本,所有用到的都会是这个版本
按图操作。。
然后ok,在pom.xml中就会对jar包指定版本,
应该可以改成其他版本吧?
搞定~
解决方案2:排除加载
就是在别的用到这个jar包的地方加上说明,告诉它不用自己加载依赖用别人的。
按图操作。。
这里可以看到它默认每个都排除加载了,那就是所以都不加载,那就是没有加载肯定报错,所以要去掉一个不用排除
搞定~
所以还是方案一方便...
版权声明:本文标题:Maven依赖冲突的两种解决方式 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1725726776a1039055.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论