[jboss-dev-forums] [Design of JBoss Build System] - Re: Shared Parent POM for dependencyManagement

adrian@jboss.org do-not-reply at jboss.com
Tue Mar 18 13:33:48 EDT 2008


"dimitris at jboss.org" wrote : 
  | So the important bit is to make sure we fix those duplicate imports.

It's more complicated than that.

Let me give you an example of why the maven transitive dependencies
stuff is broken (or at least impossible to manage effectively).

X->Y means X depends on Y

Lets suppose you have a util project with two versions
common-core:1.0.0
common-core:1.0.1

then you have
jbossxb:2.0.0 -> common-core:1.0.0

Now you have a project that uses both (but a different version of common-core)

jbossmc:2.0.0 -> jbossxb:2.0.0
jbossmc:2.0.0 -> common-core:1.0.1

Which gets used? common-core:1.0.1 of course (it is explicit)

You have another project that does
jboss-deployers:2.0.0 -> jbossmc:2.0.0
jboss-deployers:2.0.0 -> jbossxb:2.0.0

Now which version of common-core gets used?
The answer is common-core:1.0.1 because jbossmc is first in the list

Finally here's the problem
jbossas:5.0.0 -> jboss-deployers:2.0.0
jbossas:5.0.0 -> jbossxb:2.0.0

The version that gets used is common-core:1.0.0

Why? 

Even though jboss-deployers resolves to common-core:1.0.1 and it
is first on the list, its link to common-core is two steps away,
but jbossxb's link is one step away.

Stupid.

The only answer is go through all the poms and check them
(what I call baby sitting).

if you get the wrong answer then either do an exclusion or list the
dependency you want explicitly.

BUT DO YOU REALLY KNOW THAT YOU SHOULD BE USING common-core:1.0.1?

What if you listed jbossxb before jboss-deployers in the jbossas project?

The fundamental problem is that maven has no idea that 1.0.1 is after 1.0.0
and that regardless of where it is in the dependency hierarchy it should be used.

The other approach is to list everything explicitly in every project
but you've still got to "babysit" your pom when you upgrade dependencies
to see wether its transitive dependencies are later and therefore need
updating in your project.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137534#4137534

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137534



More information about the jboss-dev-forums mailing list