什么是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
...........
如果你打开这些任务的源$ C $ C,你将看到 CallTarget
包含一个蚂蚁
对象和代表大部分的工作吧:
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屋!