1。
Antelope网址:http://antelope.tigris.org/
我用到过一个控制时间的标签
2。ant-contrib
网址:ant-contrib.sourceforge.net
我用到过<if><else><then>等逻辑标签。
下面是我写的一个ant片断,用来copy不存在的文件,如果存在,则询问是否覆盖。
<!-- tasks for copy required system files -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="../WEB-INF/lib/ant-contrib-1.0b2.jar" />
<target name="deploySysFiles">
<var name="targetFile" unset="true" />
<property name="targetFile" value="${JavaStatusSchemePath}" />
<var name="originalFile" unset="true"/>
<property name="originalFile" value="${JavaStatusSchemePath-Original}"/>
<antcall target="deploySysFile" />
</target>
<target name="deploySysFile">
<echo>check file : ${targetFile} exist or not</echo>
<available file="${targetFile}" property="targetFileExisting" />
<if>
<not>
<isset property="targetFileExisting" />
</not>
<then>
<antcall target="copyTargetFile" />
</then>
<elseif>
<isset property="targetFileExisting" />
<then>
<antcall target="overrideTargetFile" />
</then>
</elseif>
</if>
<echo>deploy system files over</echo>
</target>
<target name="overrideTargetFile">
<limit seconds="${timeoutSecond}">
<input validargs="y,n" addproperty="answer" defaultvalue="n" message="file '${targetFile}' already existed,do you want to override?" />
</limit>
<condition property="override">
<equals arg1="y" arg2="${answer}" />
</condition>
<if>
<isset property="override" />
<then>
<echo>override the file...</echo>
<copy tofile="${targetFile}" file="${originalFile}" overwrite="true" encoding="ms932" />
</then>
</if>
</target>
<target name="copyTargetFile">
<echo>file ${targetFile} dose not existed,deploying this file</echo>
<copy file="${originalFile}" tofile="${targetFile}" encoding="ms932" />
</target>
<!-- end copy system files. -->