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

Problem resolving latest jar from multiple repositories containing same jar with different versions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0-RC2
    • None
    • None
    • Windows XP SP2, JDK 1.6.0.05

    Description

      This problem may be related to my configuration, but if it is, I'm not sure how to fix it.

      My project has a dependency on a jar that I build with another project. This jar can be found in two different maven repositories, one local and one shared. The jars have different modification dates but the same revision (SNAPSHOT) in either repository. I need Ivy to find the latest of the two jars. Both repositories are located on my local filesystem, for testing purposes.

      Ivy does not seem to return the latest of the two jars. It seems to randomly select one, from what I can see. I have debugged into the code and I think I found the problem, but not the cause or a solution.

      I have attached my configuration. please note that there may be a typo or two since I had to change some things for the sake of anonymity.

      Here are the sequence of events which occur to cause this problem:

      • Code enters AbstractResolver.checkLatest(ResolvedModuleRevision, ResolveData), passing in the local artifact
      • Code returns artifact as latest since its the first one found
      • Code enters the checkLatest method again with the second (and newer by modification date) artifact
      • Code calls isAfter(newModuleFound, previousModuleFound, data.getDate())
        • newModuleFound is the second artifact, newer by date
        • previousModuleFound is the first artifact, which is older
        • data.getDate() is null
      • isAfter() creates an array [ newModuleFound, previousModuleFound ] and passes that to LatestRevisionStrategy.findLatest()
      • findLatest() iterates over the array backwards
        • findLatest() states that it iterates backwards because, and I quote: "the latest revision comes last, use a ListIterator to iterate the sorted list in the reverse direction.". Now, this is incorrect in my case since the array passed in clearly has the newer module found (the jar with the newer modification date) in slot 0
      • findLatest() returns the older revision artifact because the assumptions it makes about the array are wrong

      I hope that makes sense. If there's anything else that you need to replicate this problem, please let me know.

      Thank you,

      • Juliano DeCarvalho

      Attachments

        1. ivysettings.xml
          2 kB
          Juliano DeCarvalho
        2. ivy.xml
          0.3 kB
          Juliano DeCarvalho
        3. build.xml
          1.0 kB
          Juliano DeCarvalho

        Activity

          People

            Unassigned Unassigned
            jdecarvalho Juliano DeCarvalho
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: