dependencyManagement is basically a way to standardize versions for 
dependencies across descendant modules. For example, if I put the following in 
the root pom of my multi-module project:

   <dependencyManagement>
     ...
     <dependency>
       <groupId>gnu-getopt</groupId>
       <artifactId>getopt</artifactId>
<version>1.0.13</version> </dependency>
     ...
   </dependencyManagement>

Then in any descendant poms that have deps on getopt, I can put:

   <dependencies>
     ...
     <dependency>
       <groupId>gnu-getopt</groupId>
<artifactId>getopt</artifactId> <!-- NOTE: The version is defined in the root POM's dependencyManagement section. --> </dependency> ... <dependencies>

And they'll inherit the version that is defined in the root pom. Then when I 
want to upgrade my entire project to a newer version of getopt, I only need to 
edit a single line in the root pom.


[EMAIL PROTECTED] wrote:
Say I have parent pom called A  and child pom called B. I specified
<module> element for B inside A and also
specified <parent> element for A inside B. Now I dont understand I
would have to declare <dependencyManagement> element in A. Say if I
have B, C, D as child modules and B, C, D all 3 depend on junit then
can I declare junit as dependency in A using <dependencies> element
instead <dependencyManagement> and in that B, C, D inherit that
<dependency> instead of each B, C, D declaring the dependency. If so
in what cases do I use <dependencyManagement>.

I read the online documentation available at maven site but the
<dependencyManagement> documentation section is not clear to me. Can
anyone please explain <dependencyManagement> with an example.

Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to