关于Maven的传递依赖原则 nearest definition 的一个疑问
来源:互联网 发布:suse linux无法连接ftp 编辑:程序博客网 时间:2024/06/12 00:37
Maven 官网上说
Dependency mediation - this determines what version of a dependency will be used when multiple versions of an artifact are encountered. Currently, Maven 2.0 only supports using the "nearest definition" which means that it will use the version of the closest dependency to your project in the tree of dependencies. You can always guarantee a version by declaring it explicitly in your project's POM. Note that if two dependency versions are at the same depth in the dependency tree, until Maven 2.0.8 it was not defined which one would win, but since Maven 2.0.9 it's the order in the declaration that counts: the first declaration wins.
Dependency mediation - this determines what version of a dependency will be used when multiple versions of an artifact are encountered. Currently, Maven 2.0 only supports using the "nearest definition" which means that it will use the version of the closest dependency to your project in the tree of dependencies. You can always guarantee a version by declaring it explicitly in your project's POM. Note that if two dependency versions are at the same depth in the dependency tree, until Maven 2.0.8 it was not defined which one would win, but since Maven 2.0.9 it's the order in the declaration that counts: the first declaration wins.
- "nearest definition" means that the version used will be the closest one to your project in the tree of dependencies, eg. if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0
在编译A的时候如果没有指明依赖中D的版本,那么Maven默认会把离得近的D拿来用,如果一样近,则选择先声明的版本,这种规则会不会导致错误?比如C用到了D 2.0的新特性,但是因为nearest definition原则导致最终在编译A的时候采用的是D 1.0于是导致A中使用到B的地方出现了问题?
但其实这个问题也maven也没有什么关系- -
0 0
- 关于Maven的传递依赖原则 nearest definition 的一个疑问
- 关于Maven的依赖传递
- maven依赖的原则
- Maven传递性依赖原则
- maven 依赖的传递性
- Maven的传递性依赖
- maven的依赖传递与排除依赖
- 关于php_apc的一个疑问
- 关于php_apc的一个疑问
- 关于数据结构的一个疑问
- 一个关于PCA的疑问
- Maven依赖排除 禁止依赖传递 取消依赖的方法
- Maven依赖排除 禁止依赖传递 取消依赖的方法
- Maven依赖排除 禁止依赖传递 取消依赖的方法
- Maven依赖排除 禁止依赖传递 取消依赖的方法
- Maven依赖排除 禁止依赖传递 取消依赖的方法
- Maven依赖排除 禁止依赖传递 取消依赖的方法
- Maven依赖排除 禁止依赖传递 取消依赖的方法
- 完全理解Gson(1):简单入门
- 【ThinkPHP】数据库增删查改
- javafx button show onAction or lambda "->"
- (转)ORACLE SEQUENCE 详解 .
- UIView 模态动画
- 关于Maven的传递依赖原则 nearest definition 的一个疑问
- Windows wamp安装phalcon
- JDBC驱动中的核心代码位置
- servlet小结
- JAVA正则表达式 Pattern和Matcher
- 酒的配方
- Apache+Tomcat实现负载均衡
- HttpServletRequest各方法的作用及用法
- 如何用一个充气娃娃走上创业成功巅峰--基本流程