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>不仅用于对子项目的依赖的版本管理,还用于对它自身所在的项目的依赖的版本管理。
     
  • 相关阅读:
    将博客搬至CSDN
    一种全新的屏幕适配方法 自动百分比适配 一切px说了算
    一些精品开源代码
    Android View 事件分发机制 源码解析 (上)
    Android 高清加载巨图方案 拒绝压缩图片
    Android EventBus实战 没听过你就out了
    Markdown 11种基本语法
    JavaScript 语言基础知识点总结(思维导图)
    隐藏滚动条 支持Chrome, IE (6+), Firefox, Opera, and Safari
    (function(){})(this)
  • 原文地址:https://www.cnblogs.com/mongotea/p/11973195.html
Copyright © 2011-2022 走看看