在项目中使用spring-framework-bom统一管理jar包版本

来源:互联网 发布:手机服务器端口 编辑:程序博客网 时间:2024/06/14 23:16

一般在项目中进行 spring 版本管理的话 使用

<properties><spring-version>4.2.5.RELEASE</spring-version><properties/><dependencies><dependency>     <groupId>org.springframework</groupId>     <artifactId>spring-core</artifactId>     <version>${spring-version}</version> </dependency> <dependencies>

这样的话就可以统一jar包版本了 但是 要是引用多个spring jar包依赖 那么你需要重复的写 version这个标签

现在 SpringSource 为了解决这些 Jar 冲突,推出了各种 BOM,当然最著名的就是 spring platform io bom
其中最核心的三个是:spring-framework-bom、spring-boot-dependencies、platform-bom。

项目中可以这么用:

<dependencyManagement>    <dependencies>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-framework-bom</artifactId>            <version>4.2.5.RELEASE</version>            <type>pom</type>            <scope>import</scope>        </dependency>        <!--一般项目用上面这个进行管理jar包就行了 下面的是boot项目使用的-->        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-dependencies</artifactId>            <version>1.3.0.M2</version>            <type>pom</type>            <scope>import</scope>        </dependency>        <dependency>            <groupId>io.spring.platform</groupId>            <artifactId>platform-bom</artifactId>            <version>1.1.3.RELEASE</version>            <type>pom</type>            <scope>import</scope>        </dependency>    </dependencies></dependencyManagement>

先就写到这里 以后做 boot 项目再完善

0 0