1.概述:

  dependency management是maven所擅长的东西之一,是maven的特色功能。

  参考资料:1)maven官网documentation

        2)

2.maven的依赖机制

  1)maven中的依赖是可传递的(transitive denpendencies)

  • pom.xml可以继承parent pom.xml
  • 可以自动继承该项目所依赖的三方工程(dependencies)依赖的其他工程
  • 由于maven管理的项目,其依赖是可传递的,所以就容易出现一个问题,那就是依赖有可能形成一个循环(cycle)

  2)dependency scope依赖范围是可控的

      There are 6 scopes available:

  • compile(默认)
    This is the default scope, used if none is specified【指定】. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated【传播】 to dependent projects.
  • provided
    This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.
  • runtime
    This scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.
  • test
    This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases. This scope is not transitive.
  • system
    This scope is similar to provided except that you have to provide the JAR which contains it explicitly【显式地】. The artifact is always available and is not looked up in a repository.
  • import(only available in Maven 2.0.9 or later)
    This scope is only supported on a dependency of type pom in the <dependencyManagement> section. It indicates the dependency to be replaced with the effective list of dependencies in the specified【指定的】 POM's <dependencyManagement> section. Since they are replaced, dependencies with a scope of import do not actually participate in limiting the transitivity of a dependency.

  2)怎么通过maven的pom.xml给自己的project添加external dependencies

转载于:https://www.cnblogs.com/lxrm/p/6192665.html

Maven---学习心得---maven的Dependency Mechanism(依赖关系机制)相关推荐

  1. Spring IOC学习心得之注册bean的依赖关系

    registerDependentBean方法的解析(注册bean的依赖关系) 源码如下: public void registerDependentBean(String beanName, Str ...

  2. Maven学习(二) -- 坐标和依赖

    标签(空格分隔): 学习笔记 坐标 实际就像在几何中,我们用一对坐标(x, y)来表示坐标系中唯一的点:或者我们可以用(经度,纬度)来表示地球上的某一个位置,在Maven的世界中,有坐标来唯一的表示项 ...

  3. Maven学习(二) -- 坐标和依赖(转自--江湖小妞)

    坐标 实际就像在几何中,我们用一对坐标(x, y)来表示坐标系中唯一的点:或者我们可以用(经度,纬度)来表示地球上的某一个位置,在Maven的世界中,有坐标来唯一的表示项目. 他们由groupId,  ...

  4. 【Maven学习】Maven打包生成包含所有依赖的jar包

    http://blog.csdn.net/u013177446/article/details/54134583 ******************************************* ...

  5. Maven学习(一) - Maven基础

    2019独角兽企业重金招聘Python工程师标准>>> Maven作为Java语言的构建和依赖管理工具,已经被广泛使用.但对于maven的pom.xml的配置以及插件的使用,大部分人 ...

  6. Maven学习(一)——Maven入门

    为什么80%的码农都做不了架构师?>>>    一.Maven的基本概念 Maven(翻译为"专家","内行")是跨平台的项目管理工具.主要服 ...

  7. andriod studio 查看项目依赖_Intellij IDEA 中如何查看maven项目中所有jar包的依赖关系图...

    Maven 组件界面介绍 如上图标注 1 所示,为常用的 Maven 工具栏,其中最常用的有: 第一个按钮:Reimport All Maven Projects 表示根据 pom.xml 重新载入项 ...

  8. maven学习:maven 的入门

    2.maven 的入门 到目前为止,我们已经大概了解并安装好了Maven,现在,我们开始创建一个最简单的Hello World项目. 2.1 在Idea创建maven项目 创建一个Maven项目也十分 ...

  9. Intellij IDEA 中如何查看maven项目中所有jar包的依赖关系图

    IntelliJ IDEA使用教程 (总目录篇) Maven 组件界面介绍 如上图标注 1 所示,为常用的 Maven 工具栏,其中最常用的有: 第一个按钮:Reimport All Maven Pr ...

最新文章

  1. Linux系统巡检shell脚本
  2. OpenVINO 部署 YOLOv5 转换IR文件
  3. Delphi 与 C/C++ 数据类型对照表
  4. 机器视觉与深度神经网络—洗去浮华,一窥珠玑
  5. $git学习总结系列(4)——gitignore文件
  6. 电池和Adapter切换电路改进实验(转)
  7. iis提示“另一个程序正在使用此文件,进程无法访问”解决办法
  8. php字符编码转换问题
  9. 计算机实验室安全知识心得体会,浅谈高校计算机实验室的安全管理
  10. eclipse安装Subclipse(svn数据源)
  11. GB/T 18487电动汽车充电领域国家标准解析 篇一(充电术语和定义)
  12. 高效上网教程---如何免费下载全网中英文论文
  13. html页面如何拉长,HTML可以拉长的logo
  14. C# 用Microsoft.Office.Interop.PowerPoint类库操作PPT
  15. android 为摄像头增加闪光灯(s5pv210)
  16. TERMIOS详解【转】
  17. 【华人学者风采】李烨 华为
  18. CSS中background-size的cover属性
  19. 73 [backtrader期货策略]十大经典策略-菲阿里四价(逻辑优化版)
  20. ESP8266 初次使用

热门文章

  1. 解决VS2017使用scanf报错问题
  2. Shell——read读取控制台输入和函数
  3. 递归与分治——全排列问题
  4. Intel(R)Turbo Boost Technology Driver上面显示为感叹号
  5. Java技术小册(基础篇)
  6. NET CLR via c# 第4版笔记 第19章 可空值类型
  7. 1209.1——快速排序算法
  8. Behavior Designer笔记
  9. Apache URLRewrite 原理及配置实现
  10. static_cast, dynamic_cast, reinterpret_cast, const_cast区别比较