如果使用的是spring平台bom表,是否应该使用父级?
有些依赖项版本不在,所以我添加了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
<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的插件管理等。