总结
通过导入<scope>import</scope>,能够使 外面包括dependencyManagement的dependency,无视继承规则,但是能够跟继承他这个依赖差不多一样的作用。
今天,跟了个项目,发现springboot没有parent依赖,按照之前讲的,不就是不能依赖管理吗?
那为什么,我导入的时候可以不使用版本号使用呢?
带着疑惑...........
通过继承
(里面已经给我们,通过properties指定了版本号,也通过dependencyManagement声明了相关依赖,就等我们的子模块去引用他,什么是引用? 写依赖但是不写版本号) 。然后就能使用它了。
我们项目中没有的parent -->
pring-boot-starter-parent 又继承自 spring-boot-dependencies,也就是我们现在项目的这个依赖
卧槽,那tm就要说一下上图这个
<type>pom</type> <scope>import</scope>
<scope>import</scope>,能够使 外面包括dependencyManagement的dependency,无视继承规则,但是能够跟继承差不多一样的作用,相当于我们继承上图spring-boot-depencies。。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>