Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果使用的是spring平台bom表,是否应该使用父级?_Spring_Maven_Spring Boot - Fatal编程技术网

如果使用的是spring平台bom表,是否应该使用父级?

如果使用的是spring平台bom表,是否应该使用父级?,spring,maven,spring-boot,Spring,Maven,Spring Boot,有些依赖项版本不在,所以我添加了spring平台BOM,父项声明是否仍然有用 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.2.1.RELEASE</version> </parent> &l

有些依赖项版本不在,所以我添加了spring平台BOM,父项声明是否仍然有用

<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>

org.springframework.boot
spring启动程序父级
1.2.1.发布
io.spring.platform
平台物料清单
1.1.1.发布
聚甲醛
进口

我个人更喜欢使用
平台bom
作为父项,即

<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>

io.spring.platform
获取所有托管依赖项的完整列表


编辑:正如Andy Wilkinson指出的那样,spring平台继承了
spring boot starter父级
,因此中描述的所有“合理默认值”也适用

导入BOM表(在
dependencyManagement
部分)和使用
parent

dependencyManagement
中导入的BOM仅提供依赖项的默认值,但父级方式也包括其他部分(
插件
插件管理
依赖项
依赖项管理
…)


因此,当您删除父级
springbootstarter父级
时,您必须先复制
插件管理
内容。

如果您不是在从事专业项目,我认为这很好。如果它是专业级的,那么你就不想让spring bom作为你的父母——你会有自己的。有趣:)我猜你指的是@sodik:没有特别的参考,只是maven Knowe还有一点值得注意的是
平台bom
继承自
spring boot starter父母
所以,通过使用
platformbom
作为父级,您还可以继承Boot的插件管理等。