How to override the location of Ivy's Cache?

陌路散爱 提交于 2019-11-26 17:45:12

问题


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.


回答1:


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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/1293113/how-to-override-the-location-of-ivys-cache

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!