【问题标题】:How to override Spring Boot dependencies default version?如何覆盖 Spring Boot 依赖项默认版本?
【发布时间】:2017-01-29 12:34:08
【问题描述】:

如何更改 Spring Boot 依赖项的默认版本? 例如 Spring Boot 1.4 使用 Thymeleaf 2.1 版本,但 Thymeleaf 的最新版本是 3.0。那么如何将2.1版本改为3.0呢?

【问题讨论】:

    标签: spring maven spring-boot pom.xml


    【解决方案1】:

    文档describes how to do this

    从问题上的标签来看,您使用的是 Maven。您应该在应用程序的 pom.xml 中添加一个属性来设置 Thymeleaf 版本:

    <properties>
        <thymeleaf.version>3.0.1.RELEASE</thymeleaf.version>
    </properties>
    

    还有一个sample application 展示了如何将 Thymeleaf 3.0 与可能感兴趣的 Spring Boot 1.4 结合使用。

    【讨论】:

      【解决方案2】:

      Andy 提供的答案仅在您的 POM 继承自 spring-boot-dependencies 时才有效。当通过dependencyManagement 添加spring-boot-dependencies 时,您必须重新定义要覆盖的所有工件。无赖!

      这在Andy引用的文档中也有说明(可能是后来添加的)。

      猜你喜欢
      • 1970-01-01
      • 2020-06-06
      • 1970-01-01
      • 2014-09-15
      • 1970-01-01
      • 2021-11-26
      • 2022-01-19
      • 1970-01-01
      相关资源
      最近更新 更多