ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juliano DeCarvalho (JIRA)" <>
Subject [jira] Created: (IVY-966) Problem resolving latest jar from multiple repositories containing same jar with different versions
Date Thu, 06 Nov 2008 19:50:48 GMT
Problem resolving latest jar from multiple repositories containing same jar with different

                 Key: IVY-966
             Project: Ivy
          Issue Type: Bug
    Affects Versions: 2.0-RC2
         Environment: Windows XP SP2, JDK
            Reporter: Juliano DeCarvalho

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.

My configuration:


		<property name="ivy.shared.default.root" value="c:/repos/shared" />

		<property name="ivy.local.default.root" value="c:/repos/local" />
		<property name="ivy.local.default.ivy.pattern" value="[organisation]/[module]/[revision]/ivy.xml"
		<property name="ivy.local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"

		<ivy:settings file="ivysettings.xml" />
		<ivy:resolve file="ivy.xml" />
		<ivy:retrieve pattern="./[artifact]-[revision].[ext]" />


<ivy-module version="2.0">
    <info organisation="com.test" module="testapp" />
        <dependency org="com.test" name="components-codegenUtils" rev="4.1.0-SNAPSHOT"
        	<include type="jar" />


	<settings defaultResolver="default" />

	<property name="ivy.shared.default.root" value="${ivy.default.ivy.user.dir}/shared" override="false"
	<property name="ivy.shared.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
override="false" />
	<property name="ivy.shared.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
override="false" />

	<property name="ivy.local.default.root" value="${ivy.default.ivy.user.dir}/local" override="false"
	<property name="ivy.local.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
override="false" />
	<property name="ivy.local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
override="false" />

		<filesystem name="local" m2compatible="true">
			<ivy pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />
			<artifact pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}"

		<filesystem name="shared" m2compatible="true">
			<ivy pattern="${ivy.shared.default.root}/${ivy.local.default.ivy.pattern}" />
			<artifact pattern="${ivy.shared.default.root}/${ivy.local.default.artifact.pattern}"

		<chain name="main" dual="true">
			<resolver ref="shared" />

		<chain name="default" returnFirst="false">
			<resolver ref="local" />
			<resolver ref="main" />

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)
- 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.

View raw message