How do I tell ivy4r to stay offline?

♀尐吖头ヾ 提交于 2019-12-12 10:03:01

问题


We recently switched from Ant to Buildr for building our projects. We use Ivy for dependency management, using the ivy4r Buildr extension. We have a local repository at the office which is used as a cache for public artifacts and in which we also publish our own artifacts.

Now for the problem: I'd like to be able to build my project when I do not have access to the office repository. Buildr has a flag to tell it to work offline (-o), but ivy4r does not seem to take this into account. Is there any way to make Ivy not try to download artifacts? I have them all available in the cache on my machine already.


回答1:


Setting the cache timeout to eternal

You can set the cache property ${ivy.cache.ttl.default} to eternal this will set the TTL: so that the repository will not be checked for new revisions.

You could achieve this by calling ant with the following parameter:

ant -Divy.cache.ttl.default=eternal build

This is from the documentation:

Defines a TTL (Time To Live) rule for resolved revision caching. When Ivy resolves a dynamic version constraint (like latest.integration or a version range), it can store the result of the resolution (like latest.integration=1.5.1) for a given time, called TTL. It means that Ivy will reuse this dynamic revision resolution result without accessing the repositories for the duration of the TTL, unless running resolve in refresh mode.

...

The TTL duration can also be set to 'eternal', in which case once resolved the revision is always use, except when resolving in refresh mode.

Other references:

  • IVY-879 Implementation of this feature

Setting UseCacheOnly for the resolve task

The resolve task has the attribute useCacheOnly, which can be used to

force[s] the resolvers to only use their caches and not their actual contents

Example:

<ivy:resolve file="path/to/ivy.xml" useCacheOnly="true/>


来源:https://stackoverflow.com/questions/6971517/how-do-i-tell-ivy4r-to-stay-offline

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