Maven-06可选依赖

 假设有这样一个依赖关系,项目A依赖于项目B,项目B依赖于项目X和Y,B对于X和Y的依赖是可选依赖:A->B、B->X(可选)、B->Y(可选)。根据传递依赖的定义,如果所有这三个依赖范围都是compile,那木X、Y就是A的compile返元的传递性依赖,然而,由于这里XY是可选依赖,依赖不会得以传递。换句话说,XY将不会对A有任何影响。

optional:
Marks optional a dependency when this project itself is a dependency. Confused? For example,
imagine a project A that depends upon project B to compile a portion of code that may not
be used at runtime, then we may have no need for project B for all project. So if project X

adds project A as its own dependency, then Maven will not need to install project B at all.
Symbolically, if => represents a required dependency, and --> represents optional, although
A=>B may be the case when building A X=>A-->B would be the case when building X.
In the shortest terms, optional lets other projects know that, when you use this project, you do
not require this dependency in order to work correctly.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值