I'll give you what I've got... Like I said, however, if I introduce revision
patterns (like 1.0.+) then Ivy seems to resolve every time.
Hope this helps,
Josh
The cache and resolver sections of my ivysettings file
==========================================================
<caches>
<cache
name="shares-cache"
basedir="${ivy.default.ivy.user.dir}/cache-shares"
defaultTTL="1d">
<ttl
organisation="com.myorg"
duration="0d 1h" />
</cache>
</caches>
<resolvers>
<filesystem
name="local"
checkmodified="true"
changingMatcher="regexp"
changingPattern=".*_SNAPSHOT">
<ivy pattern="${ivy.local.default.root}/${repo.ivy.pat}" />
<artifact pattern="${ivy.local.default.root}/${repo.artifact.pat}" />
</filesystem>
<url
name="shared"
cache="shares-cache">
<ivy pattern="${repo.root}/${repo.ivy.pat}" />
<artifact pattern="${repo.root}/${repo.artifact.pat}" />
</url>
<packager
name="public"
cache="shares-cache"
buildRoot="${ivy.default.ivy.user.dir}/packager/build"
resourceCache="${ivy.default.ivy.user.dir}/packager/cache">
<ivy pattern="${repo.root}/${repo.ivy.pat}" />
<artifact pattern="${repo.root}/${repo.packager.pat}" />
</packager>
</resolvers>
<!-- <include url="${ivy.default.settings.dir}/ivysettings-public.xml" />
-->
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml" />
<include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"
/>
The dependencies in one of my ivy.xml files
=========================================================
<!-- Build dependencies -->
<dependency
org="javax.javaee"
name="javaee-api"
rev="5.0"
conf="build->default" />
<dependency
org="org.apache.commons"
name="commons-logging"
rev="1.1.1"
conf="build->default" />
<!-- Deploy dependencies -->
<!-- Test dependencies -->
<dependency
org="org.junit"
name="junit"
rev="4.5"
conf="test->default" />
<!-- Tool dependencies -->
<dependency
org="com.puppycrawl"
name="checkstyle"
rev="5.0"
conf="checkstyle->default" />
The applicable sections of my build file
========================================================
<macrodef name="ivysetup">
<sequential>
<property
name="my.ivy.settings.file"
location="${user.home}/.ant/ivysettings.xml" />
<ivy:settings
file="${my.ivy.settings.file}"
id="ivy.instance" />
<ivy:info />
</sequential>
</macrodef>
<target
name="dependencies"
depends="validate,
dependencies:ivyboot,
dependencies:module,
dependencies:resolve,
dependencies:retrieve"
description="Uses the dependency manager for acquiring the dependencies"
/>
<target name="dependencies:ivyboot">
<ivysetup />
</target>
<target name="dependencies:module">
<property
name="package.name"
value="${ivy.module}" />
</target>
<target
name="dependencies:resolve"
unless="no.ivy.resolve">
<ivy:resolve conf="*, !ant" />
</target>
<target
name="dependencies:retrieve"
unless="no.ivy.resolve">
<property
name="ivylib.pattern"
value="${lib.d}/[conf]/[artifact](-[classifier]).[ext]" />
<ivy:retrieve
pattern="${ivylib.pattern}"
sync="true" />
</target>
First run in my module's build
========================================================
dependencies:resolve:
[ivy:resolve] :: resolving dependencies :: com.myorg#my-module;work...@hawk
[ivy:resolve] confs: [build, default, test, checkstyle]
[ivy:resolve] found javax.javaee#javaee-api;5.0 in shared
[ivy:resolve] found org.apache.commons#commons-logging;1.1.1 in shared
[ivy:resolve] found org.junit#junit;4.5 in shared
[ivy:resolve] found com.puppycrawl#checkstyle;5.0 in shared
[ivy:resolve] downloading
http://myreposerver/repository/modules/javax.javaee/javaee-api/5.0/jars/javaee-api-5.0.jar...
[ivy:resolve] ........................................................
(610kB)
[ivy:resolve] [SUCCESSFUL ] javax.javaee#javaee-api;5.0!javaee-api.jar
(16ms)
[ivy:resolve] downloading
http://myreposerver/repository/modules/org.apache.commons/commons-logging/1.1.1/jars/commons-logging-1.1.1.jar...
[ivy:resolve] ...... (59kB)
[ivy:resolve] [SUCCESSFUL ]
org.apache.commons#commons-logging;1.1.1!commons-logging.jar (0ms)
[ivy:resolve] downloading
http://myreposerver/repository/modules/org.apache.commons/commons-logging/1.1.1/javadocs/commons-logging-javadoc-1.1.1.zip...
[ivy:resolve] ......... (138kB)
[ivy:resolve] [SUCCESSFUL ]
org.apache.commons#commons-logging;1.1.1!commons-logging-javadoc.zip(javadoc)
(16ms)
[ivy:resolve] downloading
http://myreposerver/repository/modules/org.apache.commons/commons-logging/1.1.1/sources/commons-logging-source-1.1.1.zip...
[ivy:resolve] .... (73kB)
[ivy:resolve] [SUCCESSFUL ]
org.apache.commons#commons-logging;1.1.1!commons-logging-source.zip(source)
(15ms)
[ivy:resolve] downloading
http://myreposerver/repository/modules/org.junit/junit/4.5/jars/junit-4.5.jar...
[ivy:resolve] .............. (194kB)
[ivy:resolve] [SUCCESSFUL ] org.junit#junit;4.5!junit.jar (47ms)
[ivy:resolve] downloading
http://myreposerver/repository/modules/com.puppycrawl/checkstyle/5.0/jars/checkstyle-5.0.jar...
[ivy:resolve]
...........................................................................................................................................................
(1780kB)
[ivy:resolve] [SUCCESSFUL ] com.puppycrawl#checkstyle;5.0!checkstyle.jar
(47ms)
[ivy:resolve] :: resolution report :: resolve 297ms :: artifacts dl 187ms
---------------------------------------------------------------------
| | modules || artifacts
|
| conf | number| search|dwnlded|evicted||
number|dwnlded|
---------------------------------------------------------------------
| build | 2 | 2 | 2 | 0 || 4 | 4
|
| default | 0 | 0 | 0 | 0 || 0 | 0
|
| test | 1 | 1 | 1 | 0 || 1 | 1
|
| checkstyle | 1 | 1 | 1 | 0 || 1 | 1
|
---------------------------------------------------------------------
dependencies:retrieve:
[ivy:retrieve] :: retrieving :: com.myorg#my-module [sync]
[ivy:retrieve] confs: [build, default, test, checkstyle]
[ivy:retrieve] 6 artifacts copied, 0 already retrieved (2856kB/31ms)
Second run (LAN unplugged)
==========================================================
dependencies:resolve:
[ivy:resolve] :: resolving dependencies :: com.myorg#my-module;work...@hawk
[ivy:resolve] confs: [build, default, test, checkstyle]
[ivy:resolve] found javax.javaee#javaee-api;5.0 in shared
[ivy:resolve] found org.apache.commons#commons-logging;1.1.1 in shared
[ivy:resolve] found org.junit#junit;4.5 in shared
[ivy:resolve] found com.puppycrawl#checkstyle;5.0 in shared
[ivy:resolve] :: resolution report :: resolve 78ms :: artifacts dl 15ms
---------------------------------------------------------------------
| | modules || artifacts
|
| conf | number| search|dwnlded|evicted||
number|dwnlded|
---------------------------------------------------------------------
| build | 2 | 0 | 0 | 0 || 4 | 0
|
| default | 0 | 0 | 0 | 0 || 0 | 0
|
| test | 1 | 0 | 0 | 0 || 1 | 0
|
| checkstyle | 1 | 0 | 0 | 0 || 1 | 0
|
---------------------------------------------------------------------
dependencies:retrieve:
[ivy:retrieve] :: retrieving :: com.myorg#my-module [sync]
[ivy:retrieve] confs: [build, default, test, checkstyle]
[ivy:retrieve] 0 artifacts copied, 6 already retrieved (0kB/32ms)
On Tue, Jun 16, 2009 at 6:24 AM, Dima, Alina <
[email protected]> wrote:
> Has anyone actually tested this TTL attribute? I have been trying it around
> all day with no results. I just cannot make it work, and additionally, I
> have noticed that although I set the ivy.cache.ttl.default to different
> values for different caches, the value printed in the resolve logs is always
> 10s...I keep getting messages:" Override ignored for property
> "ivy.cache.ttl.default"". I would really appreciate it if someone who has
> worked with this attribute and has an example of how the resolution log
> looks like when this attribute is used successfully could help me out :)
>
> What I am trying to do is avoid "work offline" for a given set of libraries
> for a particular amount of time, that is avoid the whole search in the
> repositories... anyone know maybe of another way to achieve this?
>
> Thanks
> Alina
>
> -----Ursprüngliche Nachricht-----
> Von: Dima, Alina [mailto:[email protected]]
> Gesendet: Dienstag, 16. Juni 2009 09:04
> An: [email protected]
> Betreff: AW: Ivy cache TTL not working
>
> Hi,
>
> Yes, my resolver points to this extern cache. This ist he resolver I use:
>
> <chain name="is24-extern-resolver" returnFirst="true">
>
> <filesystem name="extern-localfs" cache="extern">
> <ivy
> pattern="${local.extern.repository.dir}/[organisation]/[module]/ivy-[revision].xml"
> />
> <artifact
> pattern="${local.extern.repository.dir}/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"
> />
>
> </filesystem>
>
> <filesystem name="extern-cached-libraries" cache="extern" local="false">
> <ivy
> pattern="${extern.repository.dir}/[organisation]/[module]/ivy-[revision].xml"
> />
> <artefact
> pattern="${extern.repository.dir}/[organisation]/[module]/[type]s/[artifact-[revision].[ext]"
> />
> </filesystem>
>
> </chain>
>
> However, Ivy seems to not find the items in the cache and keep searching
> the repositories. I have no idea what the problem is. My resolver runs in
> normal resolve mode, not in refresh.
>
> Thanks
> Alina
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected] [mailto:[email protected]] Im Auftrag von
> Joshua Tharp
> Gesendet: Montag, 15. Juni 2009 19:10
> An: [email protected]
> Betreff: Re: Ivy cache TTL not working
>
> The URL is
> http://ant.apache.org/ivy/history/2.1.0-rc1/settings/caches/ttl.html<
> http://ant.apache.org/ivy/history/2.1.0-rc1/settings/caches/ttl.htmlparticularly
> >and
> I think Archie meant to say in "refresh" mode. Although, the
> documentation says the refresh mode defaults to false, so unless you've set
> it to true, that shouldn't be the issue.
>
> Does your resolver in your ivysettings file point to the extern cache?
>
> On Mon, Jun 15, 2009 at 9:03 AM, Archie Cobbs <[email protected]
> >wrote:
>
> > See
> >
> http://ant.apache.org/ivy/history/2.1.0-rc1/settings/caches/ttl.htmlparticularly
> > the reference to "resolve mode". I would guess resolve operates
> > in "resolve mode".
> >
> > -Archie
> >
> > On Mon, Jun 15, 2009 at 8:26 AM, Dima, Alina <
> > [email protected]> wrote:
> >
> > > Hi,
> > >
> > >
> > >
> > > I am trying to use the TTL attribute on my cache for all external
> > > libraries. I want ivy to not check the central extern repository for
> > > those libraries, not to even search for them in there, and just use the
> > > versions in the cache. My cache setting is:
> > >
> > >
> > >
> > > <cache name="extern" basedir="${ivy.cache.extern.dir}">
> > >
> > > <ttl duration="4d"/>
> > >
> > > </cache>
> > >
> > >
> > >
> > > When I create the resolver used for external libs, I use the cache
> > > extern.
> > >
> > >
> > >
> > > However, the resolve outputs:
> > >
> > >
> > >
> > > [ivy:resolve] is24-extern-resolver: Checking cache for: dependency:
> > > apache#commons-configuration;latest.integration
> > > {terms=[ConfigurationFactory]}
> > >
> > > [ivy:resolve] no cached resolved revision for
> > > apache#commons-configuration;latest.integration
> > >
> > > [ivy:resolve] no cached resolved revision for
> > > apache#commons-configuration;latest.integration
> > >
> > >
> > >
> > > And then
> > >
> > >
> > >
> > > [ivy:resolve] found apache#commons-configuration;1.1 in
> > > extern-cached-libraries
> > >
> > > [ivy:resolve] [1.1]
> > > apache#commons-configuration;latest.integration
> > >
> > >
> > >
> > > The extern-cached-libraries is my external rep.
> > >
> > >
> > >
> > > Why does ivy still search for this lib with every resolve if TTL is set
> > > to 4days. Is there something I am missing?
> > >
> > >
> > >
> > > Thanks a lot
> > >
> > > Alina
> > >
> > >
> >
> >
> > --
> > Archie L. Cobbs
> >
>