Child and parent pom pom

 

Reproduced in: https://www.jianshu.com/p/6215af9801a0

I. used in the packet mode for the parent module pom:

<!-- 在父pom中的dependencies标签中的jar配置,子pom会直接继承 -->
<depedencies> ... </depedencies> 

Sub-modules will be directly inherited from the parent module in a jar
in this way are generally used: configure each module requires a jar package and other configuration information in the parent pom


Second, the leader packet used in the embodiment as parent module pom:

<dependencyManagement>
  <dependencies> ... </dependencies> </dependencyManagement> 

Sub-module pom pom does not automatically inherit the parent module in a jar, if you need to use, it is necessary to give groupId and artifactId , without giving version
in this manner configured by the parent unified management module dependent version


to sum up

Maven <dependencyManagement> and <dependencies> difference

<Dependencies> directly in the jar to the project management is dependencies. (If you have a parent pom, sub-pom, pom the child can only passively accept the version of the parent pom)

<DependencyManagement> key management version, for sub-module inherits the same parent module is useful, centralized management relies version does not add dependencies to define which version of the sub-pom pom does not have to inherit the parent version defined.



Author: silent _8421
link: https: //www.jianshu.com/p/6215af9801a0
Source: Jane books
are copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

Guess you like

Origin www.cnblogs.com/wsnan/p/12052846.html