蚂蚁取决于与antcall [英] ant depends vs. antcall

查看:208
本文介绍了蚂蚁取决于与antcall的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在定义的顺序生成步骤我使用取决于目标元素的属性。我最近看到一只蚂蚁文件,其中构建顺序是由 antcall 目标中的元素定义。
为了说明:

When defining sequential build steps I use the depends attribute of the target element. I have recently seen an ant file, where the build sequence was defined by antcall elements inside the targets. To illustrate :

<target name="a" depends="b">
...</target>

VS

<target name="a">
<antcall target="b"/>
...</target>

有两种方法之间真正的区别吗?就是其中之一preferable?

Is there a real difference between the two approaches? Is one of them preferable?

推荐答案

这两种方法之间的主要区别在于,在目标取决于总是的执行的,而在 antcall 目标只有在包含目标是执行。

The main difference between both approaches is that targets in depends are always executed, while targets in antcall are executed only if the containing target is.

有一个明确的例子:

<target name="a" depends="b" if="some.flag">

</target>

在这里, B 就一定会执行,而 A 仅在将被执行some.flag 定义。

Here, b will always be executed, while a will be executed only if some.flag is defined.

<target name="a" if="some.flag">
    <antcall target="b" />
</target>

在这里, B 才会执行,如果 A 的,也就是说,如果部分。标志定义。

Here, b will only be executed if a is, i.e. if some.flag is defined.

这篇关于蚂蚁取决于与antcall的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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