AntCall 和 Ant 任务有什么区别? [英] what's the difference between AntCall and Ant tasks?
问题描述
AntCall 任务(在此处描述)和Ant 任务(在 此处 中描述),除了 Ant 任务运行在不同的构建文件?
Is there any substantial difference between the AntCall task (described here) and the Ant task (described here), except for the fact that Ant task runs on a different build file?
推荐答案
这实际上取决于您所说的实质性差异"是什么意思.区别在于一个调用另一个,所以基本上是同一个东西,但在不同的上下文中使用.
It really depends on what you mean by "substantial difference". The difference would be that one calls the other, so basically is the same thing but used in different contexts.
这里是 defaults.properties
的一个片段,它定义了标准的 Ant 任务:
Here is a snippet from defaults.properties
which defines the standard Ant tasks:
ant=org.apache.tools.ant.taskdefs.Ant
antcall=org.apache.tools.ant.taskdefs.CallTarget
...........
如果打开这些任务的源代码,您将看到 CallTarget
包含一个 Ant
对象并将大部分工作委托给它:
If you open up the source code of these tasks you will see that CallTarget
contains an Ant
object and delegates most of the work to it:
public class CallTarget extends Task {
private Ant callee;
...........
...........
/**
* Delegate the work to the ant task instance, after setting it up.
* @throws BuildException on validation failure or if the target didn't
* execute.
*/
public void execute() throws BuildException {
if (callee == null) {
init();
}
if (!targetSet) {
throw new BuildException(
"Attribute target or at least one nested target is required.",
getLocation());
}
callee.setAntfile(getProject().getProperty("ant.file"));
callee.setInheritAll(inheritAll);
callee.setInheritRefs(inheritRefs);
callee.execute();
}
..........
..........
}
这篇关于AntCall 和 Ant 任务有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!