ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: auto download of antlibs
Date Mon, 09 Feb 2004 07:29:35 GMT
> OK, now that Ant1.6 has antlibs, it is time to think of the 
> next step: 
> auto download of antlibs and (perhaps) dependencies.
> 1. Possible requirements
> -allow users to specify the URLs of dependent antlibs

Why only AntLibs? Maybe resources in general (jars, AntLets, ...)

> -allow teams to provide an override point that specifies their location
of course :-)

I wrote a snippet for the download :-)

<project name="common-define-require">
    <scriptdef name="require" language="javascript">
        <attribute name="file"/>
        <attribute name="url"/>
            // If 'file' is not present, download it from 'url'.
            // Maybe you have to set the proxy before with <setproxy>
            f = new"file"));
            if (!f.exists()) {
                url = new"url"));
                get = project.createTask("get");

<property name="ant.test.lib" value="ant-testutil.jar"/>
<import file="${antcommon.dir}/define-require.xml"/>
<require file="${ant.test.lib}"

> -secure download -only files from trusted sources are fetched.

- download the MD5 file and check for consistency

Have that :-)
But it´s longer so see at the buttom

> -caching of downloads, global or per-user

or per-project

> -go through proxies

> -allow antlib providers to move their files (handle redirects)
> -allow antlib providers to mirror, by having a mirror file that lists 
> possible sources
> -support private repositories (intranet/internet, https, 
> authenticated) 
> as well as public sources
> -make it easy to publish an antlib, and register it in the 
> ant central list

I had only a half ear on the thread, but Forrest a feature like
skin" which sounds  like the whole stuff here ...

> Anything else?

Be open to plug in another kind of repo. Not only file based. Maybe 
a scm tool (cvs, ...).

> 2. What things implement this? What do Maven and Ruper do?

Yep. Talk with them. Maybe we can get their code ... or decide not to do
anything ...

> 3. do we want to integrate this with ant, or have some more standalone 
> tool that can be used to keep a component repository up to date, a tool 
> with an ant task for use in a build file. A sort of apt-getfor apache 
> stuff...

More something in the middle: an AntLib.


<project default="main">

    <taskdef resource="net/sf/antcontrib/"/>

    <property name="result.file"
    <property file=""/>
    <property file="${result.file}"/>

    <target name="main">
        <setproxy proxyHost="${}" proxyPort="${proxy.port}"/>
        <foreach list="${file.list}" param="file" target="checkFile"/>

    <target name="checkFile"
depends=",check.md5-1,check.md5-2" if="file"/>

    <target name="check.init">
        <property name="zip.file" value="${file}"/>
        <property name="md5.file" value="${file}.md5"/>
        <condition property="md5-ok"><isset
        <condition property="download-ok">
                <available file="${dest.dir}/${zip.file}"/>
                <available file="${dest.dir}/${md5.file}"/>

    <target name="" unless="download-ok" depends="check.init">
        <echo>Download ${md5.file}</echo>
        <get src="${download.md5.dir}/${md5.file}"
        <echo>Download ${zip.file}</echo>
        <get src="${}/${zip.file}"

    <target name="check.md5-1" if="md5-ok" depends="check.init">
        <echo>${zip.file}: just processed</echo>

    <target name="check.md5-2" unless="md5-ok" depends="check.init">
            <!-- what is the valid md5 value specified in the md5 file -->
            <loadfile srcFile="${md5.file}" property="md5.valid">
                        <replaceregex pattern="${zip.file}" replace=""/>
            <!-- what is the actual md5 value -->
            <checksum file="${zip.file}" property="md5.actual"/>
            <!-- compare them -->
            <condition property="md5.isValid">
                <equals arg1="${md5.valid}" arg2="${md5.actual}"/>
            <property name="md5.isValid" value="false"/>
            <!-- print the result -->
                <istrue value="${md5.isValid}"/>
                    <echo>${zip.file}: ok</echo>
                    <echo file="${result.file}"
                    <echo>${zip.file}: Wrong MD5 checksum !!!</echo>
                    <echo>- expected: ${md5.valid}</echo>
                    <echo>- actual  : ${md5.actual}</echo>
                    <move file="${zip.file}"



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message