differences between dependencymanagement and dependencies of maven

Posted by hguser on Stack Overflow See other posts from Stack Overflow or by hguser
Published on 2010-04-12T02:43:16Z Indexed on 2010/04/12 2:53 UTC
Read the original article Hit count: 477

Filed under:
|
|

Hi: What is the differences between dependencymanagement and dependencies? I have seen the docs at apache maven web site.However I got nothing. It seems that a dependency defined under the DependencyManagement can be used in its child modules without sepcify the version.For example:

A parent project(Pro-par) define a dependency under the dependencyManagement:

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8</version>
    </dependency>
 </dependencies>
</dependencyManagement>

Then at the child of Pro-par, I can use the junit :

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
 </dependencies>

However I wonder if it is necessary to define the junit at the parent pom? Why not define it directly at the needed module?

© Stack Overflow or respective owner

Related posts about maven

Related posts about dependencies