[ 
https://issues.apache.org/jira/browse/IVY-1614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17270099#comment-17270099
 ] 

Jaikiran Pai commented on IVY-1614:
-----------------------------------

I had a deeper look at this one and the related code. This issue doesn't have 
to do with the apparent syntax difference of version range specifiers. Turns 
out this issue boils down to the version number comparison algorithm that Ivy 
uses. Ivy, as noted in the doc[1], for "latest-revision" strategy:

"compares the revisions as strings, using an algorithm close to the one used in 
PHP version_compare function"

The specific example in this issue uses the org.eclipse.emf:common module with 
a version range [2.3.0,3.0.0). The Maven central repo has 2.1.0 and 
2.3.0-v200706262000 versions for this module (in the maven-metadata.xml). Ivy 
does identify 2.3.0-v200706262000 as a potential match. This potential match is 
then compared against the version range that is specified [2.3.0,3.0.0) in this 
case. It compares 2.3.0-v200706262000 against 2.3.0 (the lower range) and the 
result of this comparison states that 2.3.0-v200706262000 is "lesser" than 
2.3.0, so Ivy rejects this version. This result matches the result of php 
version_compare function that the code follows (as documented). Of course, this 
contradicts to what Maven tool does with version comparisons (it considers 
2.3.0-v200706262000 "greater" than 2.3.0). So that's why it works with Maven 
but not in Ivy.

On a related note, you can see that the version range specifier syntax isn't 
the cause of this issue, because in the example you mention, Ivy does 
successfully resolve the dependency:

<dependency org="org.eclipse.core" name="runtime" rev="[3.3.0,4.0.0)" 
force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>

it's only the following two dependencies:

<dependency org="org.eclipse.emf" name="common" rev="[2.3.0,3.0.0)" 
force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="org.eclipse.core" name="resources" rev="[3.3.0,4.0.0)" 
force="true" conf="optional->compile(*),master(*)"/>

where it goes wrong due the version compare logic.

[1] https://ant.apache.org/ivy/history/2.5.0/settings/latest-strategies.html

> Ivy needs to translate Maven version ranges
> -------------------------------------------
>
>                 Key: IVY-1614
>                 URL: https://issues.apache.org/jira/browse/IVY-1614
>             Project: Ivy
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>            Reporter: Björn Kautler
>            Assignee: Jaikiran Pai
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Syntax for version ranges is differing between Maven and Ivy.
> If a dependency is installed from a Maven repository and installed to an Ivy 
> repository using the install task, the version ranges need to be translated.
> For example if you install from Maven Central to some Ivy repository the 
> library {{org.eclipse.emf:ecore:2.3.0-v200706262000}}, then you end up with 
> this in your Ivy file:
> {code:xml}
> <dependency org="org.eclipse.emf" name="common" rev="[2.3.0,3.0.0)" 
> force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
> {code}
> while in Ivy syntax this should be
> {code:xml}
> <dependency org="org.eclipse.emf" name="common" rev="[2.3.0,3.0.0[" 
> force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to