zoukankan      html  css  js  c++  java
  • 3.1-1 dependencyManagement中的type为pom用法

     
    以第3章示例:spmia-chapter3-master中的子项目confsvr为例说明:
    其pom文件内容摘要如下:
     
      <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.4.RELEASE</version>
      </parent>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Camden.SR5</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
     
      <dependencies>
        <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-config-server</artifactId>
        </dependency>
     
        <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
      </dependencies>
     
    我们使用idea导入该工程,打开该子项目的pom.xml文件,然后右键中选择“show effective pom”,这会打开一个名为“configurationserver-effective-pom.xml”的窗口。
    上面的<scope>import</scope>表示将版本为Camden.SR5的依赖spring-cloud-dependencies所对应的pom文件信息导入进来。
    所以名为“configurationserver-effective-pom.xml”的窗口中的<dependencyManagement>元素会将pom.xml扩展开来,所以会有很多内容。
     
    我们对名为“configurationserver-effective-pom.xml”的窗口中的<dependencyManagement>元素下的内容和pom.xml中声明的两个依赖的最终版本号进行分析:
      <dependencies>
        <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-config-server</artifactId>
          <version>1.2.2.RELEASE</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-config</artifactId>
          <version>1.2.2.RELEASE</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    就会发现 <dependencyManagement>不仅用于对子项目的依赖的版本管理,还用于对它自身所在的项目的依赖的版本管理。
     
  • 相关阅读:
    LR-Controller 如何自定义显示虚拟用户状态
    Jmeter Md5加密操作之-------BeanShell PreProcessor
    [编译器]dev c++单步调试
    [数据结构]二叉树创建与遍历
    [数分笔记]关于有限覆盖定理
    [数分笔记]用Dedekind切割定理证明确界定理
    [数分笔记]Dedekind切割定理的证明
    [思考的乐趣] 有趣的莫比乌斯带
    [转自Matrix67] 趣题:顶点数为多少的图有可能和自己互补
    [数分笔记]问题1.1 T1
  • 原文地址:https://www.cnblogs.com/mongotea/p/11973195.html
Copyright © 2011-2022 走看看