Please add option for ivy:configure to cache remote files for diconnected
development
-------------------------------------------------------------------------------------
Key: IVY-361
URL: http://issues.apache.org/jira/browse/IVY-361
Project: Ivy
Issue Type: Improvement
Components: Core
Affects Versions: 1.4.1
Environment: All
Reporter: Eric Crahen
(see the ivy-user@ archive for the complete discussion under the Disconnected
Development thread)
Doing disconnected development with an ivyconfig.xml that is stored on a server
somewhere is quite a challenge. ivy:configure will fail immediately
when you use the url property and the network is unavailable. One way to get
around this is to use an ant build file like this:
<?xml version="1.0" encoding="utf-8"?>
<!--
This is an expirement with creating a disconnected development
build. We still keep configuration in a central location, but
work from a local cache. As long as you build once connected,
you should be able to run disconnected.
-->
<project
xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
<!-- Prepare the location of the local cache of the remote file -->
<property name="ivy.config.cache"
value="${user.home}${file.separator}.ivy${file.separator}config${file.separator}"/>
<property name="ivy.config.xml" value="http://myserver/ivyconf.xml"/>
<!-- Convert the URL to a safe filename -->
<pathconvert property="ivy.config.cache.name">
<path path="${file.separator}${ivy.config.xml}"/>
<filtermapper>
<replacestring from="${file.separator}" to="_"/>
</filtermapper>
</pathconvert>
<!-- The local cached file name -->
<property name="ivy.config.cache.xml"
value="${ivy.config.cache}${ivy.config.cache.name}"/>
<mkdir dir="${ivy.config.cache}"/>
<!-- Start a background task to update the local cache -->
<parallel threadCount="1">
<daemons>
<get src="${ivy.config.xml}" dest="${ivy.config.cache.xml}"
ignoreerrors="true" usetimestamp="true"/>
</daemons>
</parallel>
<!-- Wait for the local file to appear in the cache -->
<waitfor maxwait="3" maxwaitunit="second">
<available file="${ivy.config.cache.xml}"/>
</waitfor>
<!-- Fail the build if the remote config file could not be obtained and was
not cached -->
<fail>
<condition><not><available
file="${ivy.config.cache.xml}"/></not></condition>
</fail>
<ivy:configure file="${ivy.config.cache.xml}"/>
</project>
Which is quite a bit of ant build logic. If ivy:configure could simply cache
the last known
copy of a remote file this could be reduced to :
<?xml version="1.0" encoding="utf-8"?>
<project
xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
<ivy:configure useCache="true" url="http://myserver/ivyconf.xml"/>
</project>
which I think is a huge benefit to the end user. And makes getting to a
disconnected build
using ivy one step simpler for those who use a centralized ivyconfig.xml
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira