检查可执行命令存在使用蚂蚁 [英] Check if executable command exists using ant

查看:152
本文介绍了检查可执行命令存在使用蚂蚁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时可以检查是否存在命令,作为蚂蚁任务的一部分。例如,我要保证YASM命令present作为蚂蚁任务的一部分。这可能吗?如果是这样,你可以提供一个例子吗?

Is it possible to check if a command exists as part of an ant task. For example, I want to ensure the "yasm" command is present as part of the ant task. Is this possible? If so, can you provide an example?

推荐答案

我能想到的要做到这一点,最好的办法是使用可用任务与联合如果在随后的目标。如果你看一看这任务页面你会看到,你可以检查看看是否有存在,那么设置一个属性。例如:

The best way I can think of to do this is by using the available task combined with an if in a subsequent target. If you take a look at that task page you will see that you can check to see if something exists then set a property. For example:

<available file="/path/to/my/file" type="file" property="file.present"/>

然后在目标你会说像&LT ;目标名称='富',如果='文件present。'&GT;

这并不检查可执行的权限,但它会变得更加接近。如果一个任务存在检查可执行权限具体情况,你可能仍然与如果目标结合起来。

That doesn't check for executable permissions but it will get much closer. If a task exists to check for the executable permission specifically you would still probably combine it with the if in the target.



原来的答案


Original answer

这是更好地使用,而不是试图执行 CP 自己蚂蚁副本任务。这使得独立于平台。

It is better to use the ant copy task instead of trying to execute cp yourself. This keeps its platform independent.

<copy todir"/some/target">
   <fileset dir="/some/src"/>
</copy>

的复制任务 Ant文档更多的使用。

More usage on the Ant documentation for the copy task.

这篇关于检查可执行命令存在使用蚂蚁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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