Here will note some useful task of ant, this maybe used in high frequency in daily operate.  But some too common task will be not mention here, such as "ant".
 
Condition
 
< condition property ="javamail.complete" >
         < and >
             < available classname ="javax.activation.DataHandler" />
             < available classname ="javax.mail.Transport" />
         and >
     condition >
 
Sets the property "javamail.complete" if both the JavaBeans Activation Framework and JavaMail are available in the classpath.
 
< condition property ="isMacOsButNotMacOsX" >
         < and >
             < os family ="mac" />

             < not >
                 < os family ="unix" />

             not >
         and >
     condition >
 
Sets the property "isMacOsButNotMacOsX " if the current operating system is MacOS, but not MacOS X - which Ant considers to be in the Unix family as well.
 
Copy
Copy a single file
< copy file ="myfile.txt" tofile ="mycopy.txt" />
Copy a single file to a directory
< copy file ="myfile.txt" todir ="../some/other/dir" />
Copy a directory to another directory
< copy todir ="../new/dir" >
         < fileset dir ="src_dir" />
     copy >
 
Copy a set of files to a directory
< copy todir ="../dest/dir" >
         < fileset dir ="src_dir" >
             < exclude name ="**/*.java" />
         fileset >
     copy >

     < copy todir ="../dest/dir" >
         < fileset dir ="src_dir" excludes ="**/*.java" />
     copy >
 
 
Zip
 
Creates a zipfile.
< zip destfile ="${dist}/manual.zip"
             basedir ="htdocs/manual"
             update ="true"
     />
zips all files in the htdocs/manual directory into a file called manual.zip in the ${dist} directory. If manual.zip doesn't exist, it is created; otherwise it is updated with the new/changed files.
 
< zip destfile ="${dist}/manual.zip" >
         < fileset dir ="htdocs/manual" />
         < fileset dir ="." includes ="ChangeLog.txt" />
     zip >
zips all files in the htdocs/manual directory, and also adds the file ChangeLog.txt in the current directory. ChangeLog.txt will be added to the top of the ZIP file, just as if it had been located at htdocs/manual/ChangeLog.txt.
 
Jar
Jars a set of files.
< jar destfile ="test.jar" basedir ="." >
         < include name ="build" />
         < manifest >
            
             < attribute name ="Built-By" value ="${user.name}" />
            
             < attribute name ="Implementation-Vendor" value ="ACME inc." />
             < attribute name ="Implementation-Title" value ="GreatProduct" />
             < attribute name ="Implementation-Version" value ="1.0.0beta2" />
            
             < section name ="common/class1.class" >
                 < attribute name ="Sealed" value ="false" />
             section >
         manifest >
     jar >
This is an example of an inline manifest specification including the version of the build program (Implementation-Version). Note that the Built-By attribute will take the value of the Ant property ${user.name}.