dependencyManagement
- 定义依赖包版本管理
- 继承不会引入依赖
- 子类dependencies引入即可才会加载依赖
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-cloud.version>Dalston.SR4</spring-cloud.version>
<java.version>1.8</java.version>
<swagger.version>2.8.0</swagger.version>
<druid.version>1.1.9</druid.version>
<jackson.version>2.9.8</jackson.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
dependencies
- 定义服务依赖包
- 服务依赖包未定义版本号,会向上寻找dependencyManagement获取版本号
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>