You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brian Bonner <bk...@gmail.com> on 2005/11/28 21:37:46 UTC

best practices question re: dependencies

In M1, in a multi-module project, you can declare dependencies in the
parent pom and then the child modules would pickup the dependencies.

The same holds true in M2, but I was wondering if this was preferred
over showing the dependency relationships between the modules.

i.e.

parent
    modA  (depends on some of the stuff in the parent)
    modB  (depends on modA and some of the stuff in the parent some
that modA has and some it doesn't)
    modC  (depends on modA and mod B)

If we declare dependencies in parent, then they all go to each mod.

However, I thought with M2, if modA was dependent upon the things in
the parent, we could move these dependencies down to modA, still
manage the versions using dependencyMgmt in the parent, and then have
modB depend on modA (and get it's dependencies) and then declare the
remaining dependencies in modB.

Finally modC would just depend on modA and modB and get the necessary
dependencies.

Both end up satisfying dependencies, but which is the preferred way to go in M2?

Brian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: best practices question re: dependencies

Posted by Alexandre Poitras <al...@gmail.com>.
I think you had to do this in Maven 1 because there was no concept of
transitive dependencies but in Maven 2, I think it is better to
declare your dependencies where they belong, ie in the child projects.
More easy to manage and track the dependencies this way.

On 11/28/05, Brian Bonner <bk...@gmail.com> wrote:
> In M1, in a multi-module project, you can declare dependencies in the
> parent pom and then the child modules would pickup the dependencies.
>
> The same holds true in M2, but I was wondering if this was preferred
> over showing the dependency relationships between the modules.
>
> i.e.
>
> parent
>     modA  (depends on some of the stuff in the parent)
>     modB  (depends on modA and some of the stuff in the parent some
> that modA has and some it doesn't)
>     modC  (depends on modA and mod B)
>
> If we declare dependencies in parent, then they all go to each mod.
>
> However, I thought with M2, if modA was dependent upon the things in
> the parent, we could move these dependencies down to modA, still
> manage the versions using dependencyMgmt in the parent, and then have
> modB depend on modA (and get it's dependencies) and then declare the
> remaining dependencies in modB.
>
> Finally modC would just depend on modA and modB and get the necessary
> dependencies.
>
> Both end up satisfying dependencies, but which is the preferred way to go in M2?
>
> Brian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
Alexandre Poitras
Québec, Canada

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org