java – 为什么google-api-client依赖于guava-jdk5?
作者:互联网
我在Maven依赖项中依赖于Guava:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.3-jre</version>
</dependency>
我还依赖于依赖关系中的Google API客户端:
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.23.0</version>
</dependency>
但由于一些奇怪的原因,这具有以下依赖性:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</dependency>
现在我的WAR结束了两个Guava JAR:
> guava-23.3-jre.jar
> guava-jdk5-17.0.jar
这给出了几个问题,因为运行时更喜欢guava-jdk5-17.0.jar,而代码是用guava-23.3-jre.jar编译的.
为什么Google API Client依赖于Guava for JDK5?拥有两个版本会不会更有意义,例如:
> google-api-client,取决于常规的番石榴,最好是版本23.3(截至当前)
> google-api-client-jdk5,它取决于Guava的JDK5
解决方法:
见https://github.com/google/google-api-java-client/issues/903.应该可以进行以下解决方法:
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
</dependency>
标签:java,google-api,maven,google-api-client,google-api-java-client 来源: https://codeday.me/bug/20190527/1163020.html