开发者

can I turn off the .ivy cache all together?

Is there a way to tell ant/ivy to not use a local $HOME/.i开发者_如何学Pythonvy2 cache?


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>


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 own ivysettings.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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜