Uploaded image for project: 'Ivy'
  1. Ivy
  2. IVY-993

latest-time strategy not compatible with version ranges in transitiv dependencies

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0-RC2
    • None
    • Core
    • kubuntu 8.04, java 1.6, ant 1.7

    Description

      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->default"/>
      <dependency org="javax.jms" name="jms" rev="[1.1,2.0[" conf="jms->default"/>
      <dependency org="javax.management" name="jmx" rev="[1.2.1,2.0[" conf="jmx->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->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 .

      Attachments

        1. ivy-latest-time.zip
          41 kB
          K. Rekk

        Activity

          People

            Unassigned Unassigned
            konstantin K. Rekk
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: