Open
Description
建议同时采用聚合和继承,使用<dependencyManagement>
管理 spring-boot-dependencies
,这样可以更方便的管理 SpringBoot 版本,也方便约束一些其它包(比如 mybatis-plus-boot-starter
)的版本,
比如/spring-boot-examples/pom.xml
:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>spring-boot-examples</artifactId>
<version>2.0.0</version>
<packaging>pom</packaging>
<modules>
<module>spring-boot-redis</module>
</modules>
<properties>
<java.version>11</java.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.3.7.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
/spring-boot-examples/spring-boot-redis/pom.xml
:
<project >
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example</groupId>
<artifactId>spring-boot-examples</artifactId>
<version>2.0.0</version>
</parent>
<artifactId>spring-boot-redis</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
Metadata
Assignees
Labels
No labels