Is there a way to tell ant/ivy to not use a local $HOME/.ivy2
cache?
In the full book on ivy, you check out the "Setting up the repositories" section:
Several repositories use the same root in your filesystem. Referenced as
${ivy.default.ivy.user.dir}
, this is by default the directory.ivy2
in your user home.Note that several things can be done by setting Ivy variables.
To set them without defining your ownivysettings.xml
file, you can:
- set an Ant property before any call to Ivy in your build file if you use Ivy from Ant
- set an environment variable if you use Ivy from the command line
For example:
<target name="resolve">
<property name="ivy.default.ivy.user.dir" value="/path/to/ivy/user/dir"/>
<ivy:resolve />
</target>
The packager resolver has also some settings to be configured to avoid ${home}
:
<packager name="ivyroundup"
buildRoot="/path/to/my/.ivy2/packager/build"
resourceCache="/path/to/my/.ivy2/packager/cache"
resourceURL="ftp://mirror.example.com/pub/resources/[organisation]/[module]/">
<ivy pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/ivy.xml"/>
<artifact pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/packager.xml"/>
</packager>
I'd create an ivysettings.xml file and specify the location of my cache using the caches directive:
<ivysettings>
<settings defaultResolver="central"/>
<caches defaultCacheDir="${ivy.settings.dir}/cache"/>
<resolvers>
<ibiblio name="central" m2compatible="true"/>
</resolvers>
</ivysettings>
I think this more explicit and is less cryptic than setting the property ivy.default.ivy.user.dir within your build file.
Update
Using this approach the ivy cleancache task can be used to purge your nominated cache directory.
<target name="clean-all" depends="clean">
<ivy:cleancache />
</target>
来源:https://stackoverflow.com/questions/5019550/can-i-turn-off-the-ivy-cache-all-together