ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject repo for reusable tasks
Date Wed, 22 Feb 2012 03:50:04 GMT
Hello all,

Currently I and AFAIK other rely on copy paste for reusing tasks.
Antlib make reusing tasks and macros easier. However I don't see wide
reuse for this. Now that ivy is become more popular, would it possible
to create a project of ant for maintaining a repo of reusable tasks ?

For example, I have this in many build files. A macro to build a jar
file from directory structure following maven directory structure:

    <macrodef name="compile-macro">
        <attribute name="source" default="src/main"/>
        <attribute name="target" default="target/${ant.project.name}"/>
        <element name="compile-path" />
        <sequential>
            <mkdir dir="@{target}"/>
            <javac destdir="@{target}"  includeantruntime="false"
source="1.7" debug="yes">
                <src path="@{source}/java"/>
                <classpath>
                    <compile-path />
                </classpath>
            </javac>
            <copy todir="@{target}" failonerror="no">
                <fileset dir="@{source}/resources"/>
            </copy>
        </sequential>
    </macrodef>


One way to avoid this, is to wrap it in an antlib, and install it in
my ~/.ant/lib. However, other can not build this project unless then
have the antlib.jar.
A possible solution would be to put it in a maven repo, and configure
ivy to download it to the current project. Tasks using this macro will
be called with "-lib path_to_jars_option".
I am not sure if there's a better way.

Wouldn't it be good idea, to create a project under ant project
umbrella beside ant libraries, that will maintain a repo of tasks
approved by the community and proven to be useful ?
Knowing that we do this by searching the net and  previous project to
copy/paste snippet, this will make it easier for us to reuse code in a
cleaner way, and will never take away any of the flexibility of ant.

What do others think ?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message