Ivy uses ONLY the revision numbers to compare versions across repositories-it 
does not use the "publication date" or any other metadata-it would be 
essentially meaningless, since there is no guarantee that any given server or 
your local computer has a correctly synchronized system clock.  If an artifact 
is found with the same revision in two different repositories, they are assumed 
to be the same and whatever repository is first in the chain will be used.  So 
in your case, Ivy finds that the most recent version in each repository is 
1.1.7.1; since they are the same, it then proceeds to download from the first 
repository in the chain.  If two revisions are different they need to have 
different revision numbers.

Incidentally, the returnFirst property (which is false by default) has no 
relation to this-setting returnFirst to true causes Ivy to get the artifact 
from the first repository in which it finds a satisfactory version without 
checking to see if there are more recent versions in other repositories.

Doug Glidden
Software Engineer
The Boeing Company
[email protected]

-----Original Message-----
From: corwin.yo [mailto:[email protected]]
Sent: Wednesday, October 21, 2009 09:18
To: [email protected]
Subject: dynamic revision and determine the most recent


Hello,

I have a problem with Ivy to find the most recent artifacts between 2 
repositories. I read this documentation :
http://ant.apache.org/ivy/history/latest-milestone/concept.html#change and the 
best practices, but I have this problem yet.

I tried many options (resolveDynamic, force) and this mailing :
http://www.nabble.com/Ivy-resolve-not-getting-latest-td25531231.html
but always without success.

My dependancies get the changing attribute in ivy.xml file.
My convention about latest.integration is like Maven with a SNAPSHOT pattern.
This my ivysettings.xml :

<ivysettings>

        <!--    <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" />-->

        <credentials host="repo.masternaut.com" realm="Artifactory Realm"
username="cruisecontrol" passwd="Pas7*!" />

        <settings defaultResolver="default" defaultConflictManager="all" />
        <include url="${ivy.default.settings.dir}/ivysettings-local.xml" />
        <resolvers>

                <!--            <filesystem name="local" checkmodified="true"
changingPattern=".*">-->
                <!--                    <ivy
pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />-->
                <!--                    <artifact
pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}"
/>-->
                <!--            </filesystem>-->

                <url name="shared" m2compatible="true" checkmodified="true"
changingPattern=".*">
                        <ivy
pattern="http://repo.masternaut.com/intlibs/[organisation]/[module]/[revision]/ivy-[revision].xml";
/>
                        <artifact
pattern="http://repo.masternaut.com/intlibs/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]";
/>
                </url>
                <url name="masternaut-repository-ext" m2compatible="true">
                        <artifact
pattern="http://repo.masternaut.com/extlibs/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]";
/>
                </url>
                <ibiblio name="maven-public" m2compatible="true" />
                <chain name="default">
                        <resolver ref="local" />
                        <resolver ref="shared" />
                        <resolver ref="masternaut-repository-ext" />
                </chain>
        </resolvers>

</ivysettings>

Log with IvyIDE (which is more verbose that ant -v):

IVYDE: calling resolve on ivy.xml

:: resolving dependencies :: masternaut#com.masternaut.widgetsgwt;1.3
        confs: [default]
        validate = true
        refresh = false
resolving dependencies for configuration 'default'
== resolving dependencies for masternaut#com.masternaut.widgetsgwt;1.3
[default]
loadData of masternaut#com.masternaut.widgetsgwt;1.3 of rootConf=default == 
resolving dependencies for masternaut#com.masternaut.widgetsgwt;1.3
[compile]
loadData of masternaut#com.masternaut.widgetsgwt;1.3 of rootConf=default == 
resolving dependencies for masternaut#com.masternaut.widgetsgwt;1.3
[package]
loadData of masternaut#com.masternaut.widgetsgwt;1.3 of rootConf=default == 
resolving dependencies 
masternaut#com.masternaut.widgetsgwt;1.3->masternaut#com.masternaut.commongwt;latest.integration
[compile->dev]
loadData of masternaut#com.masternaut.commongwt;latest.integration of 
rootConf=default
        using default to resolve
masternaut#com.masternaut.commongwt;latest.integration
default: Checking cache for: dependency:
masternaut#com.masternaut.commongwt;latest.integration {compile=[dev]} don't 
use cache for masternaut#com.masternaut.commongwt;latest.integration:
changing=true
don't use cache for masternaut#com.masternaut.commongwt;latest.integration:
changing=true
                tried
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/[revision]/ivys/ivy.xml
        listing all in
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/[revision]/ivys/ivy.xml
        using local to list all in
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/
                found 2 resources
        found revs: [1.1.7, 1.1.7.1]
        local: found md file for
masternaut#com.masternaut.commongwt;latest.integration
                =>
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/1.1.7.1/ivys/ivy.xml
(1.1.7.1)
        parser = ivy parser
No entry is found in the ModuleDescriptorCache :
/home/jbordeau/.ivy2/cache/masternaut/com.masternaut.commongwt/ivy-1.1.7.1.xml
post 1.3 ivy file: using exact as default matcher
        found ivy file in cache for masternaut#com.masternaut.commongwt;1.1.7.1
(resolved by local):
/home/jbordeau/.ivy2/cache/masternaut/com.masternaut.commongwt/ivy-1.1.7.1.xml
        default-cache: revision in cache (not updated):
masternaut#com.masternaut.commongwt;1.1.7.1
        checking masternaut#com.masternaut.commongwt;1.1.7.1 from local against 
[none]
        module revision kept as first found:
masternaut#com.masternaut.commongwt;1.1.7.1 from local don't use cache for 
masternaut#com.masternaut.commongwt;latest.integration:
checkModified=true
                tried
http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/[revision]/ivy-[revision].xml
        listing all in
http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/[revision]/ivy-[revision].xml
        using shared to list all in
http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/
ApacheURLLister found
URL=[http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/1.1.7/].
ApacheURLLister found
URL=[http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/1.1.7.1/].
                found 2 resources
        found revs: [1.1.7, 1.1.7.1]
        shared: found md file for
masternaut#com.masternaut.commongwt;latest.integration
                =>
http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/1.1.7.1/ivy-1.1.7.1.xml
(1.1.7.1)
        parser = ivy parser
Entry is found in the ModuleDescriptorCache :
/home/jbordeau/.ivy2/cache/masternaut/com.masternaut.commongwt/ivy-1.1.7.1.xml
        found ivy file in cache for masternaut#com.masternaut.commongwt;1.1.7.1
(resolved by local):
/home/jbordeau/.ivy2/cache/masternaut/com.masternaut.commongwt/ivy-1.1.7.1.xml
        default-cache: revision in cache is not up to date:
masternaut#com.masternaut.commongwt;1.1.7.1
downloading
http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/1.1.7.1/ivy-1.1.7.1.xml
...
        shared: downloading
http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/1.1.7.1/ivy-1.1.7.1.xml
                to
/home/jbordeau/.ivy2/cache/masternaut/com.masternaut.commongwt/ivy-1.1.7.1.xml.original.part
sha1 file found for
http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/1.1.7.1/ivy-1.1.7.1.xml:
checking...
        shared: downloading
http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/1.1.7.1/ivy-1.1.7.1.xml.sha1
                to /tmp/ivytmp9094608955675434442sha1
sha1 OK for
http://repo.masternaut.com/intlibs/masternaut/com.masternaut.commongwt/1.1.7.1/ivy-1.1.7.1.xml
        [SUCCESSFUL ]
masternaut#com.masternaut.commongwt;1.1.7.1!ivy.xml(ivy.original) (78ms) post 
1.3 ivy file: using exact as default matcher
        default-cache: parsed downloaded md file for 
masternaut#com.masternaut.commongwt;1.1.7.1;
parsed=masternaut#com.masternaut.commongwt;1.1.7.1
masternaut#com.masternaut.commongwt;1.1.7.1 has changed: deleting old artifacts 
deleting 
/home/jbordeau/.ivy2/cache/masternaut/com.masternaut.commongwt/jars/com.masternaut.commongwt-1.1.7.1.jar
                [1.1.7.1] masternaut#com.masternaut.commongwt
        checking masternaut#com.masternaut.commongwt;1.1.7.1 from shared against
masternaut#com.masternaut.commongwt;1.1.7.1 from local
        module revision discarded as older:
masternaut#com.masternaut.commongwt;1.1.7.1 from shared don't use cache for 
masternaut#com.masternaut.commongwt;latest.integration:
changing=true
                tried
http://repo.masternaut.com/extlibs/masternaut/com.masternaut.commongwt/[revision]/com.masternaut.commongwt-[revision].jar
        listing all in
http://repo.masternaut.com/extlibs/masternaut/com.masternaut.commongwt/[revision]/com.masternaut.commongwt-[revision].jar
        using masternaut-repository-ext to list all in 
http://repo.masternaut.com/extlibs/masternaut/com.masternaut.commongwt/
HTTP response status: 404
url=http://repo.masternaut.com/extlibs/masternaut/com.masternaut.commongwt/
CLIENT ERROR: Not Found
url=http://repo.masternaut.com/extlibs/masternaut/com.masternaut.commongwt/
problem while listing resources in
http://repo.masternaut.com/extlibs/masternaut/com.masternaut.commongwt/ with
masternaut-repository-ext:
  java.io.IOException The HTTP response code for 
http://repo.masternaut.com/extlibs/masternaut/com.masternaut.commongwt/ did not 
indicate a success. See log for more detail.
        masternaut-repository-ext: unable to list resources for
masternaut#com.masternaut.commongwt;latest.integration:
pattern=http://repo.masternaut.com/extlibs/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]
        masternaut-repository-ext: no ivy file nor artifact found for 
masternaut#com.masternaut.commongwt;latest.integration
        found masternaut#com.masternaut.commongwt;1.1.7.1 in local
        [1.1.7.1] masternaut#com.masternaut.commongwt;latest.integration
== resolving dependencies
masternaut#com.masternaut.commongwt;latest.integration->gwt#gwt-servlet;1.5.3
[dev->default]
loadData of gwt#gwt-servlet;1.5.3 of rootConf=default
        using default to resolve gwt#gwt-servlet;1.5.3
default: Checking cache for: dependency: gwt#gwt-servlet;1.5.3 {dev=[default]} 
No entry is found in the ModuleDescriptorCache :
/home/jbordeau/.ivy2/cache/gwt/gwt-servlet/ivy-1.5.3.xml
pre 1.3 ivy file: using exactOrRegexp as default matcher
        found ivy file in cache for gwt#gwt-servlet;1.5.3 (resolved by
masternaut-repository-ext):
/home/jbordeau/.ivy2/cache/gwt/gwt-servlet/ivy-1.5.3.xml
default: module revision found in cache: gwt#gwt-servlet;1.5.3
        found gwt#gwt-servlet;1.5.3 in masternaut-repository-ext == resolving 
dependencies
masternaut#com.masternaut.widgetsgwt;1.3->masternaut#com.masternaut.webraska.mapflyer;1.15.2
[compile->default]
loadData of masternaut#com.masternaut.webraska.mapflyer;1.15.2 of 
rootConf=default
        using default to resolve 
masternaut#com.masternaut.webraska.mapflyer;1.15.2
default: Checking cache for: dependency:
masternaut#com.masternaut.webraska.mapflyer;1.15.2 {compile=[default]} No entry 
is found in the ModuleDescriptorCache :
/home/jbordeau/.ivy2/cache/masternaut/com.masternaut.webraska.mapflyer/ivy-1.15.2.xml
pre 1.3 ivy file: using exactOrRegexp as default matcher
        found ivy file in cache for
masternaut#com.masternaut.webraska.mapflyer;1.15.2 (resolved by shared):
/home/jbordeau/.ivy2/cache/masternaut/com.masternaut.webraska.mapflyer/ivy-1.15.2.xml
default: module revision found in cache:
masternaut#com.masternaut.webraska.mapflyer;1.15.2
        found masternaut#com.masternaut.webraska.mapflyer;1.15.2 in shared == 
resolving dependencies
masternaut#com.masternaut.widgetsgwt;1.3->gwt#gwt-dnd;2.5.2
[compile->default]
loadData of gwt#gwt-dnd;2.5.2 of rootConf=default
        using default to resolve gwt#gwt-dnd;2.5.2
default: Checking cache for: dependency: gwt#gwt-dnd;2.5.2 {compile=[default]} 
No entry is found in the ModuleDescriptorCache :
/home/jbordeau/.ivy2/cache/gwt/gwt-dnd/ivy-2.5.2.xml
pre 1.3 ivy file: using exactOrRegexp as default matcher
        found ivy file in cache for gwt#gwt-dnd;2.5.2 (resolved by
masternaut-repository-ext):
/home/jbordeau/.ivy2/cache/gwt/gwt-dnd/ivy-2.5.2.xml
default: module revision found in cache: gwt#gwt-dnd;2.5.2
        found gwt#gwt-dnd;2.5.2 in masternaut-repository-ext == resolving 
dependencies for masternaut#com.masternaut.widgetsgwt;1.3 [dev] loadData of 
masternaut#com.masternaut.widgetsgwt;1.3 of rootConf=default Nbr of module to 
sort : 4 Sort dependencies of : masternaut#com.masternaut.commongwt;1.1.7.1 / 
Number of dependencies = 1 Sort dependencies of : gwt#gwt-servlet;1.5.3 / 
Number of dependencies = 0 Sort done for : gwt#gwt-servlet;1.5.3 Sort done for 
: masternaut#com.masternaut.commongwt;1.1.7.1
Sort dependencies of : masternaut#com.masternaut.webraska.mapflyer;1.15.2 / 
Number of dependencies = 0 Sort done for : 
masternaut#com.masternaut.webraska.mapflyer;1.15.2
Sort dependencies of : gwt#gwt-dnd;2.5.2 / Number of dependencies = 0 Sort done 
for : gwt#gwt-dnd;2.5.2 Module descriptor is processed : gwt#gwt-servlet;1.5.3
        resolved ivy file produced in
/home/jbordeau/.ivy2/cache/resolved-masternaut-com.masternaut.widgetsgwt-1.3.xml
:: downloading artifacts ::
         trying
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/1.1.7.1/jars/com.masternaut.commongwt.jar
                tried
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/1.1.7.1/jars/com.masternaut.commongwt.jar
downloading
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/1.1.7.1/jars/com.masternaut.commongwt.jar
...
        local: downloading
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/1.1.7.1/jars/com.masternaut.commongwt.jar
                to
/home/jbordeau/.ivy2/cache/masternaut/com.masternaut.commongwt/jars/com.masternaut.commongwt-1.1.7.1.jar.part
sha1 file found for
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/1.1.7.1/jars/com.masternaut.commongwt.jar:
checking...
        local: downloading
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/1.1.7.1/jars/com.masternaut.commongwt.jar.sha1
                to /tmp/ivytmp2975758677642137941sha1
sha1 OK for
/home/jbordeau/.ivy2/local/masternaut/com.masternaut.commongwt/1.1.7.1/jars/com.masternaut.commongwt.jar
        [SUCCESSFUL ]
masternaut#com.masternaut.commongwt;1.1.7.1!com.masternaut.commongwt.jar
(14ms)
        [NOT REQUIRED]
masternaut#com.masternaut.webraska.mapflyer;1.15.2!com.masternaut.webraska.mapflyer.jar
        [NOT REQUIRED] gwt#gwt-dnd;2.5.2!gwt-dnd.jar
        [NOT REQUIRED] gwt#gwt-servlet;1.5.3!gwt-servlet.jar
:: resolution report :: resolve 240ms :: artifacts dl 15ms
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |      default     |   4   |   1   |   0   |   0   ||   4   |   1   |
        ---------------------------------------------------------------------

In reading the log, if I understand, it determines correctly that the most 
recent from shared repository but it downloads from local. However the 
publication date of shared ivy-1.7.1.1.xml is most recent that this one of 
local.

There is wiered something is that if I change the order in my chain (shared 
before local) that works (it downloads from shared) and the problem is inversed 
(it does not take care the most recent from local). I have done test with 
returnFirst to false but without success.

Have got any ideas ?
--
View this message in context: 
http://www.nabble.com/dynamic-revision-and-determine-the-most-recent-tp25992333p25992333.html
Sent from the ivy-user mailing list archive at Nabble.com.

Reply via email to