maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barrie Treloar <baerr...@gmail.com>
Subject Re: Adding dependency management to parent pom causes errors
Date Wed, 12 Feb 2014 14:09:30 GMT
On 12 February 2014 20:12, Adrien Rivard <adrien.rivard@gmail.com> wrote:
> Hi,
>
> DependencyManagement is declaring dependencies(mostly for versions) and
> dependencies is using them,
> So in general you should have only dependencyManagement in the parent poms
> and only dependencies in the childs.
>
> Now there are exceptions, for example junit is generally used in all child
> projects , so you can add it in dependencies of the parent pom and it will
> be avaible in all childs.

Adding dependencies into the pom with modules is a bad idea,
There will always be an exception that breaks that rule.
Then you will be asking how do I remove a dependency from a child pom
- you can't, dont define it in the first place.

Typical exceptions would be poms whose sole purpose is to build an
assembly (zip file) for package management, or Ear poms, etc.

A best practice is to never have any dependencies in a pom that has modules.
If you want to share common dependencies between projects, then you
can look at using the inherit type relationship but that pom would be
a standalone pom with no module declarations.
Your top level project is an Aggregation pom to make running Maven easier.
See https://maven.apache.org/pom.html#Aggregation

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


Mime
View raw message