最新和旧版本冲突的两个 Maven 依赖关系 [英] Two Maven Dependency for latest and old version conflicts

查看:49
本文介绍了最新和旧版本冲突的两个 Maven 依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 here 的 spring-data-dynamoDB 项目,根据其 pom.xml 他们使用了 1.6.9.1 版本的 aws-java-sdk,但我需要为我的项目使用最新版本的 aws-java-sdk,以便使用它的一些功能来实现 Amazon s3.如果我包含它的依赖项,

Am using spring-data-dynamoDB project from here, as per its pom.xml they have used 1.6.9.1 version of aws-java-sdk, but I need to use latest version of aws-java-sdk for my project for using some of its features to implement Amazon s3 too. If I include its dependency,

<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk</artifactId>
    <version>1.7.9</version>
</dependency>

我得到如下异常,

12:51:25.298 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean '(inner bean)': [_relProvider]
12:51:25.307 [main] ERROR o.s.w.c.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.hateoas.config.HypermediaSupportBeanDefinitionRegistrar$Jackson2ModuleRegisteringBeanPostProcessor#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_halObjectMapper': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.fasterxml.jackson.databind.ObjectMapper]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) ~[spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
.......
.......

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_halObjectMapper': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.fasterxml.jackson.databind.ObjectMapper]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076) ~[spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]
.......
.......

我尝试了以下排除方法,结果也一样,

I have tried exclusions as follows and also the same result,

<dependency>
   <groupId>org.socialsignin</groupId>
   <artifactId>spring-data-dynamodb</artifactId>
   <version>1.0.0-SNAPSHOT</version>
   <exclusions>
      <exclusion>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk</artifactId>
      </exclusion>
   </exclusions>
</dependency>

现在可以在我的项目中使用最新版本的 aws-java-sdk 吗?否则 spring-data-dynamoDB pom.xml 必须更新,如果只有我能够使用它还是什么?感谢 Michaellavelle 完成了这个巨大的项目.它对我完成 DynamoDB 部分有很大帮助.

Is it possible to use latest version of aws-java-sdk in my project now?? or else spring-data-dynamoDB pom.xml have to be updated if so only I am able to use it or what?? Thanks Michaellavelle for that tremendous project. It helps me alot for completing DynamoDB part.

推荐答案

谢谢@user944849.问题是 aws-java-sdk 中使用的 jackson 库,它是 spring-data-rest-webmvc 中的较低版本并与之冲突,因此通过从 aws-java-sdk 中排除 jackson 库构建正确.我得到的解决方案是,

Thanks you @user944849. The problem is jackson libs used in aws-java-sdk which is lower version as of in spring-data-rest-webmvc and conflicts with it, so by excluding jackson libs from aws-java-sdk builds correct. Solution I got is,

<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk</artifactId>
    <version>1.7.9</version>
    <exclusions>
        <exclusion>
            <artifactId>jackson-core</artifactId>
            <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
        <exclusion>
            <artifactId>jackson-databind</artifactId>
            <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
        <exclusion>
            <artifactId>jackson-annotations</artifactId>
            <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
    </exclusions>
</dependency>

由于声誉问题,我无法提前发布答案.这可能对像我一样坚持的其他人有用.谢谢.

I am unable to post an answer early because of reputation. This may be useful for others who stuck as like me. Thank you.

这篇关于最新和旧版本冲突的两个 Maven 依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆