maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anders Hammar <and...@hammar.net>
Subject Re: Dependency overriding.
Date Fri, 03 Dec 2010 08:14:09 GMT
FIrst, don't use the name "super pom". In the Maven world, there is one pom
called the super pom and it is the pom all other poms inherits implicitly.
It's part of Maven core. DOn't use that name for anything else as it will
cause confusion. What you have is a parent pom.

Regarding your question. You should be able to override the version through
a dependencyManagement section in your pom. Per's suggestion regarding
exclusion will not work in this case.

Also, I think that you should use dependencyManagement in your parent pom as
well, not an actual dependency. Please read about the difference here:
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

/Anders

On Fri, Dec 3, 2010 at 01:14, asdas adasads <zestriddle123456@gmail.com>wrote:

> Hi,
>
>    My project has two pom's. One is a called a super pom and contains basic
> configuration for the whole project. Second pom declares "super pom" as its
> parent.
> In super pom you can find these dependency:
>
>       <dependency>
>                <groupId>org.slf4j</groupId>
>               <artifactId>slf4j-log4j12</artifactId>
>                <version>1.5.6</version>
>       </dependency>
>
> Which defines what kind of implementation all project should use for
> logging. In the second pom (child) I want to declare different logging
> implementation, namely:
>
>       <dependency>
>           <groupId>org.slf4j</groupId>
>           <artifactId>slf4j-nop</artifactId>
>           <version>1.5.6</version>
>       </dependency>
>
> But it seems that the maven builds classpath is a way where dependency from
> parent is before, dependency from child. So nop logging will not be used
> during execution.
> Is there any way change that ? (to use nop as logging implementation) I
> cannot change "super pom" file. The behavior what I'm interested is the
> same
> as method overriding in OOP.
>
> - John
>

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