You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Elliot <em...@jhu.edu> on 2010/11/03 04:38:05 UTC

Dependency resolution and version ranges

Hi, 

How does Maven use version ranges when resolving a specific version of a
dependency?  I've read this page http://docs.codehaus.org/x/IGU - a design
document for Maven 2.0 (I'm using 2.2.1) - but it doesn't quite answer my
question (or I don't understand its contents).

I have project A and B.

A declares a dependency on (say) org.springframework:spring-context with a
version range of [2.5,)
A also declares B as a dependency.

B declares a dependency on org.springframework:spring-context with a version
of 3.0.2.RELEASE.

When I view the dependency tree of project A, it resolves spring-context to
version 2.5.6.  If I understand the design document correctly, what I would
expect to happen is for project A to resolve spring-context to 3.0.2.RELEASE
(the highest soft requirement inside the prescribed range), according to the
following statement:

"Default strategy: Of the overlapping ranges, the highest soft requirement
is the version to be used. If there are no soft requirements inside the
prescribed ranges, the most recent version is used. If that does not fit the
described ranges, then the most recent version number in the prescribed
ranges is used. If the ranges exclude all versions, an error occurs."

I guess I'm just asking if someone can enlighten me: am I mis-reading the
design document?  Is it out of date?  Most importantly, if someone could
tell me why I am seeing the result I'm seeing I would really appreciate it.

Many thanks,
Elliot


-- 
View this message in context: http://maven.40175.n5.nabble.com/Dependency-resolution-and-version-ranges-tp3247903p3247903.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Dependency resolution and version ranges

Posted by Stephen Connolly <st...@gmail.com>.
You need to understand how maven sorts version numbers

On 3 Nov 2010 03:38, "Elliot" <em...@jhu.edu> wrote:


Hi,

How does Maven use version ranges when resolving a specific version of a
dependency?  I've read this page http://docs.codehaus.org/x/IGU - a design
document for Maven 2.0 (I'm using 2.2.1) - but it doesn't quite answer my
question (or I don't understand its contents).

I have project A and B.

A declares a dependency on (say) org.springframework:spring-context with a
version range of [2.5,)
A also declares B as a dependency.

B declares a dependency on org.springframework:spring-context with a version
of 3.0.2.RELEASE.

When I view the dependency tree of project A, it resolves spring-context to
version 2.5.6.  If I understand the design document correctly, what I would
expect to happen is for project A to resolve spring-context to 3.0.2.RELEASE
(the highest soft requirement inside the prescribed range), according to the
following statement:

"Default strategy: Of the overlapping ranges, the highest soft requirement
is the version to be used. If there are no soft requirements inside the
prescribed ranges, the most recent version is used. If that does not fit the
described ranges, then the most recent version number in the prescribed
ranges is used. If the ranges exclude all versions, an error occurs."

I guess I'm just asking if someone can enlighten me: am I mis-reading the
design document?  Is it out of date?  Most importantly, if someone could
tell me why I am seeing the result I'm seeing I would really appreciate it.

Many thanks,
Elliot


--
View this message in context:
http://maven.40175.n5.nabble.com/Dependency-resolution-and-version-ranges-tp3247903p3247903.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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