我的JUnit测试用例在将datastax Cassandra驱动程序升级到3.0.1后中断。添加了一个检查,以确保Google guava版本16.0.1的使用与Datastax升级页面中描述的一样:第3点。
[INFO] +- com.google.guava:guava:jar:19.0:compile
[INFO] +- com.datastax.cassandra:cassandra-driver-core:jar:3.0.1:compile
...
[INFO] | +- (com.google.guava:guava:jar:16.0.1:compile - omitted for conflict with 19.0)
java.lang.ExceptionInInitializerError
at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:1274)
at org.cassandraunit.spring.AbstractCassandraUnitTestExecutionListener.startServer(AbstractCassandraUnitTestExecutionListener.java:61)
at org.cassandraunit.spring.CassandraUnitDependencyInjectionTestExecutionListener.prepareTestInstance(CassandraUnitDependencyInjectionTestExecutionListener.java:21)
at ...
Caused by: java.lang.IllegalStateException: Detected Guava issue #1635 which indicates that a version of Guava less than 16.01 is in use. This introduces codec resolution issues and potentially other incompatibility issues in the driver. Please upgrade to Guava 16.01 or later.
at com.datastax.driver.core.SanityChecks.checkGuava(SanityChecks.java:62)
at com.datastax.driver.core.SanityChecks.check(SanityChecks.java:36)
at com.datastax.driver.core.Cluster.<clinit>(Cluster.java:68)
... 25 more
pom.xml相关部分包括:
<!-- Spring data cassandra -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-cassandra</artifactId>
<version>${org.springframework.data.cassandra.version}</version>
</dependency>
<!-- Cassandra in memory unit testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit-spring</artifactId>
<version>2.1.3.2-SNAPSHOT</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit-shaded</artifactId>
<version>2.1.3.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hectorclient</groupId>
<artifactId>hector-core</artifactId>
<version>2.0-0</version>
<optional>true</optional>
<scope>test</scope>
</dependency>
<!-- Datastax Cassandra Java driver -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.0.1</version>
</dependency>
这是Maven的依赖树。只是因为它太大了,所以才会在相关章节上复制。
...
[INFO] +- com.google.api-client:google-api-client:jar:1.20.0:compile
[INFO] | +- com.google.oauth-client:google-oauth-client:jar:1.20.0:compile
[INFO] | | +- com.google.http-client:google-http-client:jar:1.20.0:compile
[INFO] | | | +- (com.google.code.findbugs:jsr305:jar:1.3.9:compile - omitted for duplicate)
[INFO] | | | \- (org.apache.httpcomponents:httpclient:jar:4.0.1:compile - omitted for conflict with 4.3)
[INFO] | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | +- com.google.http-client:google-http-client-jackson2:jar:1.20.0:compile
[INFO] | | +- (com.google.http-client:google-http-client:jar:1.20.0:compile - omitted for duplicate)
[INFO] | | \- (com.fasterxml.jackson.core:jackson-core:jar:2.1.3:compile - omitted for conflict with 2.3.0)
[INFO] | \- com.google.guava:guava-jdk5:jar:13.0:compile
...
[INFO] +- org.springframework.data:spring-data-cassandra:jar:1.3.2.RELEASE:compile
[INFO] | +- org.springframework.data:spring-cql:jar:1.3.2.RELEASE:compile
[INFO] | | +- (org.springframework:spring-context:jar:4.1.9.RELEASE:compile - omitted for conflict with 4.1.6.RELEASE)
[INFO] | | +- (org.springframework:spring-beans:jar:4.1.9.RELEASE:compile - omitted for conflict with 4.1.6.RELEASE)
[INFO] | | +- (org.springframework:spring-core:jar:4.1.9.RELEASE:compile - omitted for conflict with 4.1.6.RELEASE)
[INFO] | | +- (org.springframework:spring-expression:jar:4.1.9.RELEASE:compile - omitted for conflict with 4.1.6.RELEASE)
[INFO] | | +- org.springframework:spring-tx:jar:4.1.9.RELEASE:compile
[INFO] | | | +- (org.springframework:spring-beans:jar:4.1.9.RELEASE:compile - omitted for conflict with 4.1.6.RELEASE)
[INFO] | | | \- (org.springframework:spring-core:jar:4.1.9.RELEASE:compile - omitted for conflict with 4.1.6.RELEASE)
[INFO] | | +- (org.springframework.data:spring-data-commons:jar:1.11.2.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (com.datastax.cassandra:cassandra-driver-dse:jar:2.1.5:compile - omitted for duplicate)
[INFO] | | +- (com.google.guava:guava:jar:14.0:compile - omitted for conflict with 19.0)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.13:compile - omitted for conflict with 1.7.5)
[INFO] | | \- (org.slf4j:jcl-over-slf4j:jar:1.7.13:runtime - omitted for conflict with 1.7.5)
[INFO] | +- (org.springframework:spring-expression:jar:4.1.9.RELEASE:compile - omitted for conflict with 4.1.6.RELEASE)
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.11.2.RELEASE:compile
[INFO] | | +- (org.springframework:spring-core:jar:4.1.9.RELEASE:compile - omitted for conflict with 4.1.6.RELEASE)
[INFO] | | +- (org.springframework:spring-beans:jar:4.1.9.RELEASE:compile - omitted for conflict with 4.1.6.RELEASE)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.13:compile - omitted for conflict with 1.7.5)
[INFO] | | \- (org.slf4j:jcl-over-slf4j:jar:1.7.13:runtime - omitted for conflict with 1.7.5)
[INFO] | +- com.datastax.cassandra:cassandra-driver-dse:jar:2.1.5:compile
[INFO] | | \- (com.datastax.cassandra:cassandra-driver-core:jar:2.1.5:compile - omitted for conflict with 3.0.1)
[INFO] | +- (org.slf4j:slf4j-api:jar:1.7.13:compile - omitted for conflict with 1.7.5)
[INFO] | \- (org.slf4j:jcl-over-slf4j:jar:1.7.13:runtime - omitted for conflict with 1.7.5)
...
[INFO] +- org.hectorclient:hector-core:jar:2.0-0:test
[INFO] | +- (commons-lang:commons-lang:jar:2.4:test - omitted for duplicate)
[INFO] | +- commons-pool:commons-pool:jar:1.5.3:test
[INFO] | +- org.apache.cassandra:cassandra-thrift:jar:2.0.4:test
[INFO] | | +- (org.apache.commons:commons-lang3:jar:3.1:test - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.2:test - omitted for conflict with 1.7.12)
[INFO] | | \- (org.apache.thrift:libthrift:jar:0.9.1:test - omitted for conflict with 0.9.2)
[INFO] | +- (com.google.guava:guava:jar:14.0:compile - scope updated from test; omitted for duplicate)
[INFO] | +- (org.slf4j:slf4j-api:jar:1.6.1:test - omitted for conflict with 1.7.12)
[INFO] | +- com.github.stephenc.eaio-uuid:uuid:jar:3.2.0:test
[INFO] | +- com.ecyrd.speed4j:speed4j:jar:0.9:test
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.6.1:test - omitted for conflict with 1.7.12)
[INFO] | \- com.yammer.metrics:metrics-core:jar:2.2.0:test
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.2:test - omitted for conflict with 1.7.12)
[INFO] +- com.google.guava:guava:jar:19.0:compile
[INFO] +- com.datastax.cassandra:cassandra-driver-core:jar:3.0.1:compile
[INFO] | +- io.netty:netty-handler:jar:4.0.33.Final:compile
[INFO] | | +- io.netty:netty-buffer:jar:4.0.33.Final:compile
[INFO] | | | \- io.netty:netty-common:jar:4.0.33.Final:compile
[INFO] | | +- io.netty:netty-transport:jar:4.0.33.Final:compile
[INFO] | | | \- (io.netty:netty-buffer:jar:4.0.33.Final:compile - omitted for duplicate)
[INFO] | | \- io.netty:netty-codec:jar:4.0.33.Final:compile
[INFO] | | \- (io.netty:netty-transport:jar:4.0.33.Final:compile - omitted for duplicate)
[INFO] | +- (com.google.guava:guava:jar:16.0.1:compile - omitted for conflict with 19.0)
[INFO] | \- io.dropwizard.metrics:metrics-core:jar:3.1.2:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.7:compile - omitted for conflict with 1.7.12)
正如您自己指出的,罪魁祸首确实是google-api-client
,它依赖于一个名为guava-jdk5
的非标准guava jar,它将guava13.0带到您的类路径中。
尝试排除它:
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.20.0</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
</dependency>
我想知道以下jar的所有传递依赖项: 将经典命令移动到pom。项目定义依赖关系和输入的xml: mvn依赖:树 将显示: 我没看到魔咒父母: 乍一看,mvn命令似乎可以显示非pom类型的依赖项。 有没有一种方法可以精确地显示使jar保持活动状态所需的每个文件? 谢谢
我的应用程序中使用了弹性城堡依赖项,我希望在pom.xml文件中排除此依赖项。即使从pom文件中删除此依赖项,它仍然出现在m2存储库文件夹中。我的应用程序是Spring-MVC 5框架,运行在Tomcat版本9上。部署时有两个不同版本的“bcprov”。我需要从pom.xml文件中排除bcprov-jdk14和bcprov-jdk15on。 下面是pom文件中的依赖关系。 我还尝试了另一个链接的排
我对Maven了解不多,只知道基本知识,这给我带来了一些问题。 我正在使用ecplise Luna和maven(EMBEDDED版本3.2.1/1.5.1.50109-1819)来管理我的项目。还安装了JBoss Tools插件来将我的项目发送到OpenShift。到目前为止还不错。 然而,我在OpenShift中面临一些错误,在论坛中研究发现,该问题与5.0.8版本的mysql连接器-java有
主要内容:排除依赖,可选依赖,排除依赖 VS 可选依赖 我们知道 Maven 依赖具有传递性,例如 A 依赖于 B,B 依赖于 C,在不考虑依赖范围等因素的情况下,Maven 会根据依赖传递机制,将间接依赖 C 引入到 A 中。但如果 A 出于某种原因,希望将间接依赖 C 排除,那该怎么办呢?Maven 为用户提供了两种解决方式:排除依赖(Dependency Exclusions)和可选依赖(Optional Dependencies)。 排除依赖
我在Netbeans-8工作 我正在构建两个项目。Project1是Project2的依赖项。 如果我在两个项目中都做了更改1 我碰巧经常更改项目1。在我的IDE中使用maven之前,我习惯于构建一个依赖项目,也构建它的依赖项。我的意思是这就是构建系统中的依赖项的全部含义... 如何解决这个问题,以便project2上的“使用依赖项构建”也构建project1?
主要内容:依赖声明,获取依赖坐标Maven 是一款优秀的依赖管理工具,那么什么是依赖呢? 通俗的说,如果一个 Maven 构建所产生的构件(例如 Jar 文件)被其他项目引用,那么该构件就是其他项目的依赖。 依赖声明 Maven 坐标是依赖的前提,所有 Maven 项目必须明确定义自己的坐标,只有这样,它们才可能成为其他项目的依赖。当一个项目的构件成为其他项目的依赖时,该项目的坐标才能体现出它的价值。 当 Maven 项目需要声