maven -- dependencyManagement

1. When you have a set of projects that inherits a common parent it's possible to put all information about the dependency in the common POM and have simpler references to the artifacts in the child POMs. 

把子module中共用部分的jar包都考虑放在parent的dependencyManagement中


2. control the versions of artifacts used in transitive dependencies

优先级:当前dependencyManagement>当前dependency>父dependencyManagement>当前dependency的dependency


3. denpendencyManagement 与 depencencies区别

depencencies 即使在子项目中不写该依赖,仍然会从父项目中继承

denpendencyManagement是偏自由的,子项目要想使用必须自己声明,不然不会引入。denpendencyManagement的好处就是子项目在引入的时候可以不写version使用默认的,当然也可以选择用新的version从而覆盖父项目定义的。


猜你喜欢

转载自blog.csdn.net/u011385186/article/details/80784826