首页 > 其他 > 详细

maven#dependencyManagement

时间:2020-02-29 21:51:52      阅读:82      评论:0      收藏:0      [点我收藏+]

dependencyManagement 用于对版本进行管理,不下载实际的jar包。

如果一个包在dependencyManagement中进行声明了,那么在pom中的<dependencies><dependency>节点下就不用些版本号了。

 

  <!--这里才会真正的下载jar包,对应的jar的版本会去dependencyManagement中去寻找,找不到就报错了,否则就要在下面写出version-->   
 <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!--依赖版本定义,这里只是声明,如果要用到jar,就用我这边规定的版本-->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Greenwich.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>0.2.1.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

 

maven#dependencyManagement

原文:https://www.cnblogs.com/luohaonan/p/12385943.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!