On Sep 16, 2010, at 2:01 PM, Marcus Linke wrote:
> Thanks for the replies first. The goal of declaring the dependencies in
> the parent pom project is to force all submodules to use these
> dependencies.
Is that really what you want?
For example:
Module A depends on hibernate & commons-lang
Module B depends on commons-lang & spring
In the parent module, are you declaring dependencies for hibernate,
commons-lang & spring? If so, then those dependencies are being unnecessarily
included in the child modules. This could be a problem, particularly for WARs,
where you'll end up with WEB-INF/lib bloat.
> When using <dependencyManagement> in parent pom each
> submodule have to declare this set of dependencies itself which seems
> really redundant to me.
This is The Maven Way. <dependencyManagement> is about *how* a particular
dependency should be include *if* it is a <dependency> of a child module.
For example, in my projects, we don't use commons-logging, but prefer slf4j. As
such, my <dependencyManagement> in the parent pom contains all the dependency
version information as well as exclusions for hibernate, etc. Something like
this:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-hibernate3</artifactId>
<version>${spring.hibernate3.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
Now in the child poms, whenever I want to use spring-hibernate3, i simply have
to add the following dependency, and it will get all the configuration from the
parent:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-hibernate3</artifactId>
</dependency>
---
Nayan Hajratwala
http://agileshrugged.com
http://twitter.com/nhajratw
734.658.6032
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]