【问题标题】:Maven control version of transitive dependencies of Spring BootSpring Boot的传递依赖的Maven控制版本
【发布时间】:2016-11-09 01:06:40
【问题描述】:

我有一个简单的 spring boot 应用程序,我正在尝试将 spring cloud consul 添加到其中。 Spring cloud consul 依赖于更新版本的 spring boot。在我的 POM 中,我为所有 Spring Boot 工件指定了版本 1.3.5.RELEASE

问题在于,即使为 spring-boot-starter-web 指定了 1.3.5 版,它仍然会下载 1.2.3 版的依赖项

有没有办法让 maven 为所有 Spring Boot 工件(包括传递依赖项)获取 1.3.5.RELEASE?我知道我可以明确列出所有这些,但有更好的方法吗?

这是来自 Eclipse 的 POM 依赖视图:

【问题讨论】:

    标签: spring maven pom.xml


    【解决方案1】:

    是的,简单地使用正确的父级:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.6.RELEASE</version>
        <relativePath/> 
    </parent>
    

    并从 Spring Boot 依赖项中删除版本。

    【讨论】:

    • 如果我不想使用父级怎么办?我尝试添加依赖管理,但没有运气。
    • 不完全。我仍然有问题。具体来说,它找不到内部类 org/springframework/boot/Banner$Mode 并且它仍在使用版本为 1.2.3 的 Spring Boot jar,即使我在依赖项管理 1.3.6 中指定
    • 所以我最终做的是让我的父母指定 spring boot starter 作为父母并且有效
    猜你喜欢
    • 2020-03-29
    • 1970-01-01
    • 2011-12-22
    • 1970-01-01
    • 2017-01-30
    • 1970-01-01
    • 1970-01-01
    • 2021-10-08
    • 2020-06-24
    相关资源
    最近更新 更多