Maven Spring BOM (bill of materials)

为了防止用Maven管理Spring项目时,不同的项目依赖了不同版本的Spring,可以使用Maven BOM来解决者一问题。

在依赖管理时,引入spring-framework-bom,如:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-framework-bom</artifactId>
            <version>4.3.1.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

即可统一版本,而且,在引入BOM之后,在引入其他Spring依赖时,都无需指定版本,如:

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
    </dependency>
<dependencies>

 

posted on 2016-07-27 14:45  孜然狼  阅读(11022)  评论(4编辑  收藏  举报

导航