ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "K. Rekk (JIRA)" <j...@apache.org>
Subject [jira] Created: (IVY-993) latest-time strategy not compatible with version ranges in transitiv dependencies
Date Tue, 06 Jan 2009 17:12:44 GMT
latest-time strategy not compatible with version ranges in transitiv dependencies
---------------------------------------------------------------------------------

                 Key: IVY-993
                 URL: https://issues.apache.org/jira/browse/IVY-993
             Project: Ivy
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0-RC2
         Environment: kubuntu 8.04, java 1.6, ant 1.7
            Reporter: K. Rekk


Using latest-time as defaultLatestStrategy="latest-time" would give errors on first level
transitiv dependency. Default strategy would do fine. It seems to be a similar problem as
in https://issues.apache.org/jira/browse/IVY-966 .

The ivy.xml of direct dependency to retrieve has:
    <dependencies>
        <dependency org="javax.mail" name="javamail" rev="[1.4,2.0[" conf="mail-&gt;default"/>
        <dependency org="javax.jms" name="jms" rev="[1.1,2.0[" conf="jms-&gt;default"/>
        <dependency org="javax.management" name="jmx" rev="[1.2.1,2.0[" conf="jmx-&gt;default,tools"/>

    </dependencies>

Although I am far away from understanding what exactly is going on (some further developer
docs would be great), here my observations:

Watching debug shows that all this boils down to call :

public class LatestTimeStrategy extends ComparatorLatestStrategy {
    private static final Comparator COMPARATOR = new Comparator() {
        public int compare(Object o1, Object o2) {
            long d1 = ((ArtifactInfo) o1).getLastModified();
            long d2 = ((ArtifactInfo) o2).getLastModified();
            return new Long(d1).compareTo(new Long(d2));
        }

to try compare Infos for 1.2.1 and 2.0  for <dependency org="javax.management" name="jmx"
rev="[1.2.1,2.0[" conf="jmx-&gt;default,tools"/> . But getLastModified will give 0.
So sorting will fail.

This interesting thing starts from VersionRangeMatcher

    private boolean isLower(ModuleRevisionId askedMrid, String revision,
            ModuleRevisionId foundMrid, boolean inclusive) {
        ModuleRevisionId mRevId = ModuleRevisionId.newInstance(askedMrid, revision);
        int result = comparator.compare(mRevId, foundMrid);        
        return result <= (inclusive ? 0 : -1);
    }

with 

foundMrid javax.management#jmx;1.2.1
mRevId javax.management#jmx;2.0

Also it would be nice to have some tests for org.apache.ivy.plugins.latest.LatestTimeStrategy
.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message