How to override the location of Ivy's Cache?
Asked Answered
S

3

24

I am using Ivy as part of my continuous integration build system, but I need to override the default location that Ivy's local cache area is.

Shirker answered 18/8, 2009 at 10:45 Comment(0)
S
5

Although the answer above from skaffman is correct, I found it to be a lot more work than I had expected!

When I added the ivysettings.xml file to the project, I then needed to redefine almost everything, as the default values had been working fine until then.

so, I found out how to add the new cache directory to the in-line command-line within my NAnt script...

< exec program="java" commandline="... ... -jar ${ivy.jar} -cache ${project.cache} ... ... />

(Where ${ivy.jar} is the location of my .jar file and ${project.cache} is the new location set earlier in the script where I want the cache area to use.)

This means that I don't need the ivysettings.xml file, and I can revert everything back to using the default resolvers, etc.

Shirker answered 19/8, 2009 at 11:45 Comment(1)
You can get the default behaviours back by adding <include url="${ivy.default.settings.dir}/ivysettings.xml"/> after the caches line in the ivysettings file.Andantino
C
19

Something like this in ivysettings.xml:

<ivysettings>
    <caches defaultCacheDir="/path/to/my/cache/dir"/>
</ivysettings>

See documentation at http://ant.apache.org/ivy/history/latest-milestone/settings/caches.html

Cosenza answered 18/8, 2009 at 10:56 Comment(2)
Ah, maybe that's where I'm going wrong - I don't have an ivysettings.xml file! How does Ivy pick up the usage of this file? I presume I pass it in through a commandline parameter?Shirker
Found this online... ant.apache.org/ivy/history/latest-milestone/standalone.html I think this answers my second question!Shirker
C
13

I'm use Jenkins as CI build system, and create $HOME/.ivy2/ivysettings.xml:

<ivysettings>
    <properties environment="env" />
    <caches defaultCacheDir="${env.WORKSPACE}/.ivy2/cache" />
</ivysettings>

This create the ivy cache dir at each jenkins job's workspace.

Clarsach answered 29/9, 2012 at 2:53 Comment(0)
S
5

Although the answer above from skaffman is correct, I found it to be a lot more work than I had expected!

When I added the ivysettings.xml file to the project, I then needed to redefine almost everything, as the default values had been working fine until then.

so, I found out how to add the new cache directory to the in-line command-line within my NAnt script...

< exec program="java" commandline="... ... -jar ${ivy.jar} -cache ${project.cache} ... ... />

(Where ${ivy.jar} is the location of my .jar file and ${project.cache} is the new location set earlier in the script where I want the cache area to use.)

This means that I don't need the ivysettings.xml file, and I can revert everything back to using the default resolvers, etc.

Shirker answered 19/8, 2009 at 11:45 Comment(1)
You can get the default behaviours back by adding <include url="${ivy.default.settings.dir}/ivysettings.xml"/> after the caches line in the ivysettings file.Andantino

© 2022 - 2024 — McMap. All rights reserved.