[ 
https://issues.apache.org/jira/browse/IVY-966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Juliano DeCarvalho updated IVY-966:
-----------------------------------

    Comment: was deleted

> Problem resolving latest jar from multiple repositories containing same jar 
> with different versions
> ---------------------------------------------------------------------------------------------------
>
>                 Key: IVY-966
>                 URL: https://issues.apache.org/jira/browse/IVY-966
>             Project: Ivy
>          Issue Type: Bug
>    Affects Versions: 2.0-RC2
>         Environment: Windows XP SP2, JDK 1.6.0.05
>            Reporter: Juliano DeCarvalho
>         Attachments: build.xml, ivy.xml, ivysettings.xml
>
>
> 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

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

Reply via email to