[code] <target name="help">
<echo>zip and copy static content to web servers</echo>
<condition property="isTestEnv">
<istrue value="${deploy.isTestEnv}" />
</condition>
<antcall target="trueCondition">
</antcall>
<antcall target="falseCondition">
</antcall>
</target>
<target name="trueCondition" if="isTestEnv">
<echo>trueCondition</echo>
</target>
<target name="falseCondition" unless="isTestEnv">
<echo>falseCondition</echo>
</target>[/code]
[code] <fileset dir="./deploy">
<include name="**/*" />
<size value="100" when="ge" />
<date datetime="${old.zip.timestamp}" pattern="${ts.pattern}" when="after" />
</fileset>[/code]
<echo>zip and copy static content to web servers</echo>
<condition property="isTestEnv">
<istrue value="${deploy.isTestEnv}" />
</condition>
<antcall target="trueCondition">
</antcall>
<antcall target="falseCondition">
</antcall>
</target>
<target name="trueCondition" if="isTestEnv">
<echo>trueCondition</echo>
</target>
<target name="falseCondition" unless="isTestEnv">
<echo>falseCondition</echo>
</target>[/code]
[code] <fileset dir="./deploy">
<include name="**/*" />
<size value="100" when="ge" />
<date datetime="${old.zip.timestamp}" pattern="${ts.pattern}" when="after" />
</fileset>[/code]
本文介绍了一个使用Ant构建工具的例子,展示了如何根据环境变量决定不同的构建路径。通过`condition`元素结合属性判断,实现true和false两种不同条件下的任务执行。
1883

被折叠的 条评论
为什么被折叠?



