On 1/5/06, Wendy Smoak <[EMAIL PROTECTED]> wrote:
On 1/5/06, Bill Dudney <[EMAIL PROTECTED]> wrote:

> Do we really end up with everything from the top level in the lib
> dir? What I'm thinking is something like this being in a 'user' project.
>
> <dependency>
>         <groupid>org.apache.myfaces</groupId>
>         <artifactId>tomahawk</artifactId>
> </depdency>
>
> This will cause the transitive dependency thing to pull in everything
> that tomahawk depends on but won't touch the top level pom as I
> understand it anyway. Am I wrong about this?

I don't know for sure, I'd have to experiment with it.  I think that
if Tomahawk inherits dependencies, then they "belong" to Tomahawk no
matter where they originally came from.  If your webapp depends on
Tomahawk, you're going to get all of them.

> I hate to repeat the info though...

Lesser of two evils? :)  My first experiences with m2 were fending off
unwanted transitive dependencies and submitting patches for poms in
the repository so my own webapps would contain the right things.

I'd rather do the work up front, and make sure that the users get
clean poms that express exactly the right dependencies for each
module.  And so far the only duplication I'm seeing is from the
dependencies that are not transitive (the ones with test or provided
scope.)

There is a significant difference in behavior between making everything a dependency of the parent pom, versus pre-defining each dependency in the <dependencyManagement> section of the parent pom, and then referencing each relevant entry as a dependency (by groupId + artifactId) in the child pom.

Here's the quote from the Maven Dependency Mechanism documentation.

"The dependency management section is a mechanism for centralizing dependency information. When you have a set of projects that inherits a common parent it's possible to put all information about the dependency in the common POM and have simpler references to the artifacts in the child POMs."

  -- http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

@Wendy:  Were you seeing problems when defining your common dependencies in the parent pom in the <dependencies> section, or in the <dependencyManagement> section?

Kind Regards,
John Fallows.
--
Author Pro JSF and Ajax: Building Rich Internet Components
http://www.apress.com/book/bookDisplay.html?bID=10044

Reply via email to