- 首先去除pom文件中的原有的parent
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/>
</parent>
- 方便开发微服务项目或者多模块项目时如需要对项目依赖版本进行统一管理,就需要使用dependencyManagement来实现了。在原dependencies外层增加dependencyManagement标签,需注意的是,如果使用dependencyManagement来管理依赖,那么子项目中需声明父类项目中的依赖才能被使用,如果父项目中直接使用dependencies来管理依赖,那么所有基层此父项目的子项目将拥有父项目中的所有依赖。
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
- 因为去掉了spring-boot-starter-parent的继承,所以我们需要手动设置Java版本及编码格式等
<properties>