It will resolve the conflicts, but here no conflict exists from Maven's point of view. The groupid is part of the coordinates so they appear to be the same. Jdom should insert a "relocation" pom to solve these issues. Your recourse is to use an exclusion. Assuming the group was the same, you would get 1.1. And lets further assume you didn't directly depend on 1.1 but had some other dependency foo, that did. Which ever brought in jdom first in your pom would be the version you end up with. In otherwords, if the depth is the same for a dependency, the first one seen wins.
2009/5/7 Niels van Kampenhout <[email protected]> > On Thu, May 7, 2009 at 1:10 PM, Ylan Segal <[email protected]> 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: [email protected] > For additional commands, e-mail: [email protected] > >
