Note of Apache Ant - Core Tasks

简介:
 
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  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 > 
            <!--  Who is building this jar? --> 
             < attribute  name ="Built-By"  value ="${user.name}" /> 
            <!--  Information about the program itself --> 
             < attribute  name ="Implementation-Vendor"  value ="ACME inc." /> 
             < attribute  name ="Implementation-Title"  value ="GreatProduct" /> 
             < attribute  name ="Implementation-Version"  value ="1.0.0beta2" /> 
            <!--  details --> 
             < 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}.




    本文转自danni505 51CTO博客,原文链接:http://blog.51cto.com/danni505/172634,如需转载请自行联系原作者


相关文章
|
XML Java Apache
【Apache Ant】ANT解析以及ANT在myEclipse中的使用
【Apache Ant】ANT解析以及ANT在myEclipse中的使用
262 0
【Apache Ant】ANT解析以及ANT在myEclipse中的使用
|
Java Apache
一个最简单的apache ant hello world例子
一个最简单的apache ant hello world例子
128 0
一个最简单的apache ant hello world例子
|
Apache
SAP Hybris安装包里自带的apache ant
SAP Hybris安装包里自带的apache ant
SAP Hybris安装包里自带的apache ant
|
应用服务中间件 Apache
通过 Apache Ant 来运行 Tomcat
通过 Apache Ant 来运行 Tomcat
123 0
通过 Apache Ant 来运行 Tomcat
|
Apache
一个最简单的apache ant hello world例子
一个最简单的apache ant hello world例子
120 0
一个最简单的apache ant hello world例子
|
Apache
SAP Hybris安装包里自带的apache ant
SAP Hybris安装包里自带的apache ant
116 0
SAP Hybris安装包里自带的apache ant
|
Apache
SAP Hybris安装包里自带的apache ant
SAP Hybris安装包里自带的apache ant
SAP Hybris安装包里自带的apache ant
|
Java Apache 数据格式
【Apache Ant】ANT解析以及ANT在myEclipse中的使用
转载请注明出处:http://blog.csdn.net/qq_26525215 本文源自【大学之旅_谙忆的博客】 维基百科上对Ant的介绍: Apache Ant,是一个将软件编译、测试、部署等步骤联系在一起加以自动化的一个工具,大多用于Java环境中的软件开发。
1318 0