Maven dependencymanagement vs dependencies
2017-11-21 20:48
387 查看
dependencyManagement集中管理依赖版本,dependencies节点声明依赖,并从父项目中继承版本号。
dependencyManagement允许在不添加所有子继承的依赖项的情况下合并和集中管理依赖版本。
dependencyManagement另一个非常重要的用例是对在传递依赖项中的版本控制。
Dependency Management allows to consolidate and centralize the management of dependency versions without adding dependencies which are inherited by all children. This is especially useful when you have a set of projects (i.e. more than one) that inherits a common parent.
Another extremely important use case of dependencyManagement is the control of versions of artifacts used in transitive dependencies. This is hard to explain without an example. Luckily, this is illustrated in the documentation.
https://stackoverflow.com/questions/2619598/differences-between-dependencymanagement-and-dependencies-in-maven
Dependency Management allows to consolidate and centralize the management of dependency versions without adding dependencies which are inherited by all children. This is especially useful when you have a set of projects (i.e. more than one) that inherits a common parent.Another extremely important use case of dependencyManagement is the control of versions of artifacts used in transitive dependencies.You still need to define them in the child POM to show that you are using them. They are not actually included in the child projects just because they are in in the parent POM. Enclosing dependencies in centralizes management of the version, scope, and exclusions for each dependency, if and when you decide to use it.
Artifacts specified in the section will ALWAYS be included as a dependency of the child module(s).Artifacts specified in the section will only be included in the child module if they were also specified in the section of the child module itself. Why is it good you ask? because you specify the version and/or scope in the parent, and you can leave them out when specifying the dependencies in the child POM. This can help you use unified versions for dependencies for child modules, without specifying the version in each child module.
dependencyManagement允许在不添加所有子继承的依赖项的情况下合并和集中管理依赖版本。
dependencyManagement另一个非常重要的用例是对在传递依赖项中的版本控制。
Dependency Management allows to consolidate and centralize the management of dependency versions without adding dependencies which are inherited by all children. This is especially useful when you have a set of projects (i.e. more than one) that inherits a common parent.
Another extremely important use case of dependencyManagement is the control of versions of artifacts used in transitive dependencies. This is hard to explain without an example. Luckily, this is illustrated in the documentation.
https://stackoverflow.com/questions/2619598/differences-between-dependencymanagement-and-dependencies-in-maven
Dependency Management allows to consolidate and centralize the management of dependency versions without adding dependencies which are inherited by all children. This is especially useful when you have a set of projects (i.e. more than one) that inherits a common parent.Another extremely important use case of dependencyManagement is the control of versions of artifacts used in transitive dependencies.You still need to define them in the child POM to show that you are using them. They are not actually included in the child projects just because they are in in the parent POM. Enclosing dependencies in centralizes management of the version, scope, and exclusions for each dependency, if and when you decide to use it.
Artifacts specified in the section will ALWAYS be included as a dependency of the child module(s).Artifacts specified in the section will only be included in the child module if they were also specified in the section of the child module itself. Why is it good you ask? because you specify the version and/or scope in the parent, and you can leave them out when specifying the dependencies in the child POM. This can help you use unified versions for dependencies for child modules, without specifying the version in each child module.
相关文章推荐
- Maven中<dependencies>节点和<dependencyManagement>节点的区别
- Differences between dependencymanagement and dependencies in maven
- Maven dependencyManagement和dependencies的区别
- maven dependencyManagement和dependencies的区别
- maven dependencyManagement和dependencies的区别
- Maven中<dependencies>节点和<dependencyManagement>节点的区别
- Maven dependencyManagement和dependencies的区别
- Maven-----dependencies PK dependencyManagement
- Maven中<dependencies>节点和<dependencyManagement>节点的区别
- maven项目jar包版本错误:'dependencies.dependency.version' for xxx:jar is missing. @ line xx, column xx
- maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.
- maven 之dependencyManagement 和 pluginManagement
- maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.
- Maven中<dependencies>节点和<dependencyManagement>节点的区别
- An internal error occurred during: "Enabling Maven Dependency Management".
- maven项目jar包版本错误:'dependencies.dependency.version' for xxx:jar is missing. @ line xx, column xx
- Maven <dependencies> 和 <dependencyManagement> 的区别
- IDEAmaven项目maven project中dependencies下dependency有红色波浪线的解决办法
- Maven工程报错:Enabling Maven Dependency Management".Unsupported IClasspathEntry kind=4
- Maven中<dependencies>节点和<dependencyManagement>节点的区别