Spring IO Platform 解决Spring项目组合中版本依赖
参考
Spring IO Platform ,解决Spring项目组合中版本依赖 https://www.cnblogs.com/zhouqinxiong/p/spring_io_platform.html https://www.jianshu.com/p/dd0baba45f52
简介
引入类库
使用Maven 方式一
使用Maven的话,在pom.xml中修改为类似这样的。
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>your-application</artifactId> <version>1.0.0-SNAPSHOT</version> <!-- 添加以下一段--> <dependencyManagement> <dependencies> <dependency> <groupId>io.spring.platform</groupId> <artifactId>platform-bom</artifactId> <version>Brussels-SR3</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <!-- Dependency declarations --> </project>
使用Maven 方式二
或者将设置Spring IO Platform为父项目也行。
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>your-application</artifactId> <version>1.0.0-SNAPSHOT</version> <parent> <groupId>io.spring.platform</groupId> <artifactId>platform-bom</artifactId> <version>Brussels-SR3</version> <relativePath/> </parent> <!-- Dependency declarations --> </project>
设置完成后,以后添加依赖项就不需要指定版本好了。可以像下面这样添加依赖。
<dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <!-- 没有版本号 --> </dependency> </dependencies>
使用Gradle 方式一
…