ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleg shteynbuk <>
Subject Using Ant Tasks Outside of Ant
Date Tue, 03 Aug 2004 17:40:59 GMT

Recently I have used Ant from Java for the first time and Ant docs 
chapter "Using Ant Tasks Outside of Ant" was very helpful, but it might 
well be that this chapter was written long time ago as in the source 
code there is a notice that use of protected members is deprecated and 
you should not be accessing this variables directly use access methods 
instead, and if protected members are not accessed directly you don't 
need derived nested class. Then code sample in docs could look like this:

    static public Project createProject() {
        Project project = new Project();
        return project;

    static public void unzip(String zipFilepath, String destinationDir) {

        Expand expander = new Expand();
        expander.setOwningTarget(new Target());

        expander.setSrc(new File(zipFilepath));
        expander.setDest(new File(destinationDir));


two lines
        Project project = new Project();
were refactored into createProject() function as in my case it is used 
for several tasks but for code sample it could be inlined into unzip() 

Also i have spend some time looking for mapping of Java classes to 
corresponding Ant tasks and maybe adding to docs sentence like this 
"Java classes could have different names from the corresponding Ant 
tasks, look at the org/apache/tools/ant/taskdefs/ 
file for mapping" could help first time users.

I'm just curious if other folks think that it could be useful.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message