Ant任务只在文件存在的情况下运行Ant目标? [英] Ant task to run an Ant target only if a file exists?

查看:157
本文介绍了Ant任务只在文件存在的情况下运行Ant目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有ANT任务只有在给定的文件存在时才会执行一个块?我有一个问题,我有一个通用的ant脚本,应该做一些特殊的处理,但只有当一个特定的配置文件存在。

Is there an ANT Task that would execute a block only if a given file exists? I have the problem that I have a generic ant script that should do some special processing but only if a specific configuration file is present.

推荐答案

p> 可用条件

<target name="check-abc">
    <available file="abc.txt" property="abc.present"/>
</target>

<target name="do-if-abc" depends="check-abc" if="abc.present">
    ...
</target> 

这篇关于Ant任务只在文件存在的情况下运行Ant目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆