第二十六章 SpringBoot不使用Parent POM

来源:互联网 发布:国内数据库厂商 编辑:程序博客网 时间:2024/04/29 03:29

不是每个人都喜欢继承 spring-boot-starter-parent POM,比如你可能需要
使用公司的标准parent,或只是倾向于显式声明所有的Maven配置。你也可以通过以下方式引入SpringBoot

<dependencyManagement>  <dependencies>    <dependency>      <groupId>org.springframework.boot</groupId>      <artifactId>spring-boot-dependencies</artifactId>      <version>1.4.3.RELEASE</version>      <type>pom</type>      <scope>import</scope>    </dependency>  </dependencies></dependencyManagement>

以上设置不允许你使用属性覆盖个别依赖,为了达到这个目的,你需要在项目的 dependencyManagement 节点中,在 spring-boot-dependencies 实体前插入一个节点。例如,为了将Spring Data升级到另一个发布版本,你需要将以下配置添加到 pom.xml 中:

<dependencyManagement>  <dependencies>  <!-- Override Spring Data release train provided by Spring Boot -->    <dependency>      <groupId>org.springframework.data</groupId>      <artifactId>spring-data-releasetrain</artifactId>      <version>Fowler-SR2</version>      <scope>import</scope>      <type>pom</type>    </dependency>    <dependency>      <groupId>org.springframework.boot</groupId>      <artifactId>spring-boot-dependencies</artifactId>      <version>1.4.3.RELEASE</version>      <type>pom</type>      <scope>import</scope>    </dependency>  </dependencies></dependencyManagement>
0 0