Maven-06可选依赖
2011-08-29 21:35
148 查看
假设有这样一个依赖关系,项目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.
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.
相关文章推荐
- maven可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)
- 【maven实战】08-可选依赖
- Maven系列之可选依赖
- maven可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)
- Maven依赖调解、 可选依赖、 依赖冲突 排除、 归类依赖、优化依赖
- maven可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)
- Maven开发笔记(二)—— Maven中的可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)
- maven 可选依赖和排除依赖
- maven可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)
- 关于maven可选依赖和排除依赖的学习
- maven可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)
- 关于maven可选依赖和排除依赖的学习
- maven可选依赖和排除依赖
- Maven依赖调解和可选依赖
- 【maven实战】06-依赖与范围
- maven optional可选依赖
- maven可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)
- maven3实战之坐标和依赖(可选依赖)
- maven可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)
- Intellij IDEA 中 Maven 项目总是提示 缺少依赖的解决办法