Discussion:
[m2] Dependency mediation
Ralph Pöllath
2005-08-26 13:24:41 UTC
Permalink
Hi,

my project has transitive dependencies on both asm 1.5.3 (from cglib
2.1_2, which I fixed locally, see [1]) and 1.4.3 (from hibernate
3.0.5). The one that ends up in my war is 1.4.3, which unfortunately
seems to be incompatible with something else I'm using [2].

From reading [3], I thought I could force m2 to use asm 1.5.3 by
listing it as a direct dependency of my project, but that doesn't
work. m2 -X reveals that both jars get selected, but then 1.5.3 gets
removed (removed - nearer found: 1.4.3). What does the "nearer found"
actually mean? Nearer to what?

For now, I can tweak the hibernate POM in my local repository, but
I'm wondering what a better solution to the general problem could
look like.

Cheers,
-Ralph.

[1] http://jira.codehaus.org/browse/MEV-66
[2] java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit
(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/
String;)V
[3] http://maven.apache.org/maven2/dependency-mechanism.html
Brett Porter
2005-08-26 13:39:34 UTC
Permalink
Nearer is nearer in the transitivity tree (if they have the same
depth, it is undefined).

So declaring it in your own POM should fix this.

In beta-1, you will hopefully be able to select from nearer and latest
(with latest now being the default, with the exception of a version
specified in the pom being built).

Note that at any point using a range of [1.5.3] will make 1.4.3 an
invalid choice and force that version. Versions without set notation
are treated as "suggestions" for which to select within the
intersection of all the valid sets.

Cheers,
Brett
Post by Ralph Pöllath
Hi,
my project has transitive dependencies on both asm 1.5.3 (from cglib
2.1_2, which I fixed locally, see [1]) and 1.4.3 (from hibernate
3.0.5). The one that ends up in my war is 1.4.3, which unfortunately
seems to be incompatible with something else I'm using [2].
From reading [3], I thought I could force m2 to use asm 1.5.3 by
listing it as a direct dependency of my project, but that doesn't
work. m2 -X reveals that both jars get selected, but then 1.5.3 gets
removed (removed - nearer found: 1.4.3). What does the "nearer found"
actually mean? Nearer to what?
For now, I can tweak the hibernate POM in my local repository, but
I'm wondering what a better solution to the general problem could
look like.
Cheers,
-Ralph.
[1] http://jira.codehaus.org/browse/MEV-66
[2] java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit
(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/
String;)V
[3] http://maven.apache.org/maven2/dependency-mechanism.html
---------------------------------------------------------------------
Ralph Pöllath
2005-08-26 14:11:03 UTC
Permalink
Post by Brett Porter
Nearer is nearer in the transitivity tree (if they have the same
depth, it is undefined).
Got it.
Post by Brett Porter
So declaring it in your own POM should fix this.
It does. My mistake, sorry.
Post by Brett Porter
In beta-1, you will hopefully be able to select from nearer and latest
(with latest now being the default, with the exception of a version
specified in the pom being built).
Note that at any point using a range of [1.5.3] will make 1.4.3 an
invalid choice and force that version. Versions without set notation
are treated as "suggestions" for which to select within the
intersection of all the valid sets.
I just read the design document on dependency mediation [1], and now
I'm wondering where to specify the version range. A version tag like
<version>[1.5.3]</version> doesn't seem to be interpreted as a range
using maven 2.0-alpha-3 (maven goes looking for asm-[1.5.3].jar on
the repository).

Thanks Brett,
-Ralph.

[1] http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and
+Conflict+Resolution
Post by Brett Porter
Post by Ralph Pöllath
Hi,
my project has transitive dependencies on both asm 1.5.3 (from cglib
2.1_2, which I fixed locally, see [1]) and 1.4.3 (from hibernate
3.0.5). The one that ends up in my war is 1.4.3, which unfortunately
seems to be incompatible with something else I'm using [2].
From reading [3], I thought I could force m2 to use asm 1.5.3 by
listing it as a direct dependency of my project, but that doesn't
work. m2 -X reveals that both jars get selected, but then 1.5.3 gets
removed (removed - nearer found: 1.4.3). What does the "nearer found"
actually mean? Nearer to what?
For now, I can tweak the hibernate POM in my local repository, but
I'm wondering what a better solution to the general problem could
look like.
Cheers,
-Ralph.
[1] http://jira.codehaus.org/browse/MEV-66
[2] java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit
(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/
String;)V
[3] http://maven.apache.org/maven2/dependency-mechanism.html
Brett Porter
2005-08-26 22:33:25 UTC
Permalink
Post by Ralph Pöllath
I just read the design document on dependency mediation [1], and now
I'm wondering where to specify the version range. A version tag like
<version>[1.5.3]</version> doesn't seem to be interpreted as a range
using maven 2.0-alpha-3 (maven goes looking for asm-[1.5.3].jar on
the repository).
Ah, sorry. I guess that's a bug that was fixed recently.

- Brett

Loading...