Springboot[官方]如何进行依赖管理
涉及到Maven的parent的知识
主要是Spring自身还有第三方模块的依赖控制。
我们可以如何进行依赖管理
wheatdr-dependencies的pom里面增加
- 模仿Spring专门建一个dependencies模块来管理
引入Springboot的dependencies,也就是spring-boot-parent的父模块。
注意scope、type设置,当然也可以在这里配置其他的springboot没有配置的依赖。
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.6.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
wheatdr-ear-learn的pom里面增加
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.wheatdr</groupId>
<artifactId>wheatdr-dependencies</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
除了wheatdr-dependencies之外模块添加parent
<parent>
<artifactId>wheat-ear-learn</artifactId>
<groupId>com.wheatdr</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>