ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject FYI: leafcutter - An API which allows you to execute Ant tasks from Java code
Date Tue, 18 Oct 2005 08:34:22 GMT
Haven´t worked with that - just found the page while visiting some blogs.

Sayed Hashimi started a discussion [1] about build tools (primarily Ant+Maven). Suggestions
in comments were combining Ant+Groovy. But also leafcutter [2] was listed.

>From leafcutter´s homepage:
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
Leafcutter is an API which allows you to execute Ant tasks from Java code. 
Leafcutter is useful as:
- A way of integrating Ant tasks into existing Java programs. 
- A wholesale alternative to standard Ant for process automation. We'll look at reasons for
doing this in a moment. 
Prior knowledge of Ant is helpful, but not necessary. 

<target name="backup" depends="init" if="backup.enabled">   
    <property name="source.dir" value="src/main"/>
    <copy todir="home/backups" verbose=true>
        <fileset dir=${source.dir}" includes="**/*.txt"/>
   </copy>
</target>

This Java code does the same job using the Leafcutter API:

public void backup(boolean enabled){
    if (enabled){
        init();
        File sourceDir = new File("src/main");
        TaskRunner.run("copy todir=home/backups verbose=true (fileset dir=${1} includes=**/*.txt)",
sourceDir);   
    }
}
---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----


In case someone want´s to play a little bit :-)

cheers
Jan


[1] http://weblogs.java.net/blog/sayedh/archive/2005/10/your_build_tool.html
[2] https://leafcutter.dev.java.net/

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


Mime
View raw message