<
condition
property
="javamail.complete"
>
< and >
< available classname ="javax.activation.DataHandler" />
< available classname ="javax.mail.Transport" />
</ and >
</ condition >
< 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 >
< 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 >
< 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 >
< fileset dir ="src_dir" >
< exclude name ="**/*.java" />
</ fileset >
</ copy >
< copy todir ="../dest/dir" >
< fileset dir ="src_dir" excludes ="**/*.java" />
</ copy >
Creates a zipfile.
<
zip
destfile
="${dist}/manual.zip"
basedir ="htdocs/manual"
update ="true"
/>
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 >
< 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
.
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 >
< 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,如需转载请自行联系原作者