仅当文件存在时才运行 Ant 目标的 Ant 任务? [英] Ant task to run an Ant target only if a file exists?

查看:29
本文介绍了仅当文件存在时才运行 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.

推荐答案

可用条件

<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天全站免登陆