springboot项目如何不依赖spring-boot-parent
在一个pom中只能存在一个<parent></parent>标签,正常情况我们创建一个springboot项目都要依赖spring-boot-starter-parent,但是有时我们项目已经有一个<parent></parent>标签,那我们可以使用dependency management的方案来解决不能依赖spring-boot-starter-parent问题。
传统spring-boot-starter-parent依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.BUILD-SNAPSHOT</version>
</parent>
dependency management方案
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
本文介绍如何在已有父依赖的项目中引入 SpringBoot 的依赖管理,避免使用 spring-boot-starter-parent。通过使用 dependencyManagement,可以灵活地管理依赖版本而不影响现有的项目结构。
2万+

被折叠的 条评论
为什么被折叠?



