maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrien Rivard <adrien.riv...@gmail.com>
Subject Re: Adding dependency management to parent pom causes errors
Date Wed, 12 Feb 2014 09:42:31 GMT
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.




On Wed, Feb 12, 2014 at 10:33 AM, geoffh <hartnell_g@yahoo.co.uk> wrote:

> Laird, Barrie
>
> Thanks for taking the time with some useful explanations
> I'd like to put more detail into my problem in the hope that you may be
> able
> to spot something I am doing wrong:
>
> I started off with parent and child poms with no dependency management -
> along the lines of:
>
> Parent pom (without dependencyManagement)
>
>                 <dependencies>
>                         <dependency>
>                                 <groupId>log4j</groupId>
>                                 <artifactId>log4j</artifactId>
>                                 <version>${log4j-version}</version>
>                         </dependency>
>
> .
> .
> .
>                 </dependencies>
>
> Child pom (without dependencyManagement)
>
>         <dependencies>
>                         <dependency>
>                                         <groupId>log4j</groupId>
>                                         <artifactId>log4j</artifactId>
>                                         <version>${log4j-version}</version>
>                         </dependency>
> .
> .
> .
>         </dependencies>
>
> As I said, 'mvn clean deploy' completed successfully with no compilation
> errors
>
>
> I then changed the parent and child poms to use dependency management -
> along the lines of:
>
> Parent pom (with dependencyManagement)
>         <dependencyManagement>
>                 <dependencies>
>                         <dependency>
>                                 <groupId>log4j</groupId>
>                                 <artifactId>log4j</artifactId>
>                                 <version>${log4j-version}</version>
>                         </dependency>
>
> .
> .
> .
>                 </dependencies>
>         </dependencyManagement>
>
>
> Child pom (with dependencyManagement)
>
>         <dependencies>
>                         <dependency>
>                                         <groupId>log4j</groupId>
>                                         <artifactId>log4j</artifactId>
>                         </dependency>
> .
> .
> .
>         </dependencies>
>
> I arranged that each child pom only referenced the dependencies it needed
> - with the parent pom having all dependencies required by all children
> After that I got the compilation error
> Interestingly, I got the same error trace when invoking 'mvn
> dependency:analyze'
>
> >The compilation error you're talking about looks like something more
> >substantial than a bad dependency--you're getting a compiler error from
> >within javac itself.
>
> However,  the compilation error did not occur in the situation without
> dependencyManagement
> If there is a genuine compilation error, would it be expected to show in
> both cases
>
> Is that the correct way to use dependencyManagement ?
>
> Thanks for reading and any help / suggestions
> Geoff
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Adding-dependency-management-to-parent-pom-causes-errors-tp5784035p5784252.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Adrien Rivard

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message