如果您正在使用Spring Platform Bom,是否应该使用父项? [英] Should you use the parent if you are using the spring platform bom?

查看:291
本文介绍了如果您正在使用Spring Platform Bom,是否应该使用父项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些依赖版本不存在,因此我添加了spring平台BOM,parent声明仍然有用吗?

Some dependency versions are not in so I've added the spring platform BOM, is the parent declaration still useful?

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

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.spring.platform</groupId>
            <artifactId>platform-bom</artifactId>
            <version>1.1.1.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

推荐答案

我个人更喜欢使用platform-bom作为父母,即

I personally prefer to use platform-bom as a parent, i.e.

<parent>
    <groupId>io.spring.platform</groupId>
    <artifactId>platform-bom</artifactId>
    <version>1.1.1.RELEASE</version>
    <relativePath />
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

通过这种方式,我不必定义spring-boot版本号,它会随着新版本的spring平台自动更新,并且我不必担心任何不一致之处.

In this way I don't have to define spring-boot version number and it is automatically updated with newer version of spring platform and I don't have to worry about any inconsistencies.

请参见 http://docs.spring.io/platform/docs/1.1.1.RELEASE/reference/htmlsingle/#appendix-dependency-versions 获取所有托管依赖项的完整列表.

See http://docs.spring.io/platform/docs/1.1.1.RELEASE/reference/htmlsingle/#appendix-dependency-versions for complete list of all managed dependencies.

编辑:如Andy Wilkinson所指出的那样,spring平台继承了spring-boot-starter-parent,因此所有<明智的默认设置>如

EDIT: As pointed out by Andy Wilkinson, spring platform inherits spring-boot-starter-parent so all "sensible defaults" as described in http://docs.spring.io/spring-boot/docs/1.2.1.RELEASE/reference/htmlsingle/#using-boot-maven apply as well.

这篇关于如果您正在使用Spring Platform Bom,是否应该使用父项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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