一些依赖版本不存在,所以我添加了 spring 平台 BOM,parent
声明仍然有用吗?
<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
作为父级,即
<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 平台,我不必担心任何不一致。
参见http://docs.spring.io/platform/docs/1.1.1.RELEASE/reference/htmlsingle/#appendix-dependency-versions有关所有托管依赖项的完整列表。
编辑:正如Andy Wilkinson所指出的,spring平台继承了spring-boot-starter-parent
,因此所有“合理的默认值”如http://docs.spring.io/spring-boot/docs/1.2.1.RELEASE/reference/htmlsingle/#using-boot-maven中所述。也适用。
关于spring - 如果使用 spring 平台 bom,是否应该使用父级?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28200261/