maven的jar包冲突问题解决方案

Bertha 。 2023-02-26 06:29 136阅读 0赞

报错信息:

  1. An attempt was made to call the method com.google.common.collect.FluentIterable.append(Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable; but it does not exist. Its class, com.google.common.collect.FluentIterable, is available from the following locations:
  2. 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
  3. It was loaded from the following location:
  4. file:/C:/Users/XXX/.m2/repository/com/google/guava/guava/16.0.1/guava-16.0.1.jar

这个原因是导入jar包的时候,jar包兼容性问题

解决方案:

  1. <dependencyManagement>
  2. <dependencies>
  3. <dependency>
  4. <groupId>com.google.guava</groupId>
  5. <artifactId>guava</artifactId>
  6. <version>20.0</version>
  7. </dependency>
  8. </dependencies>
  9. </dependencyManagement>

发表评论

表情:
评论列表 (有 0 条评论,136人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Maven Jar冲突解决方案

    Maven Jar包冲突解决方案 在Java开发中,使用Maven作为依赖管理工具是非常常见的。然而,有时候在项目中使用不同的依赖项时可能会遇到冲突的情况。本文将为您介绍如何

    相关 maven解决jar冲突

    1. maven默认使用第一声明优先的原则,即谁先声明,就使用谁。这个声明的依赖包也是优先进入项目的。 2. 路径近者优先原则。jar包导入时分如下两种。直接依赖要比传递依