On Thu, May 7, 2009 at 1:10 PM, Ylan Segal <ylan.se...@gmail.com> wrote:
> I have a conflict with a jdom dependency: Two versions are appearing in my
> classpath.
>
> The problem arises because my project uses the follwing two dependencies:
>
>
> <dependency>
>        <groupId>jdom</groupId>
>        <artifactId>jdom</artifactId>
>        <version>1.1</version>
> </dependency>
> <dependency>
>        <groupId>rome</groupId>
>        <artifactId>rome</artifactId>
>        <version>0.9</version>
> </dependency>
>
>
> Now, rome in turn uses:
>
> <dependency>
>        <groupId>jdom</groupId>
>        <artifactId>jdom</artifactId>
>        <version>1.0</version>
> </dependency>
>
> According to my (limited) understanding of maven, since I am explicitly
> stating that my project uses jdom 1.1, that should take precedence and jdom
> 1.0 should not be included.
>
> Now, when I check the dependency tree I see that:
>
> com.mydomain:myproject-1.0-SNAPSHOT
>        + org.jdom:jdom:jar:1.0 (compile)
>        + rome:rome:jar:0.9 (compile
>                + jdom:jdom:jar:1.0 (compile)
>
> Notice that groupID for the two jdom versions are different. It's jdom for
> 1.0 but org.jdom for 1.1. I believe that this is why maven is actually using
> both dependencies: It doesn't know that they are different versions of the
> same artifact.
>
> (By the way I tried setting my dependecy's groupId to org.jdom or jdom and I
> get the same result: Somehow even if I specify jdom as the groupId it
> resolves to org.jdom).
>
> Does anyone have any suggestions on how to address this?

You can exclude the rome's transitive jdom dependency like this (from
the top of my head):

<dependency>
    <groupId>rome</groupId>
    <artifactId>rome</artifactId>
    <version>0.9</version>
    <exclusions>
        <exclusion>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
        </exclusion>
    </exclusions>
</dependency>

As far as I know Maven does not automatically resolve version
conflicts between (transitive) dependencies, you just end up with both
versions of the jar.

HTH,

Niels

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

Reply via email to