小智 8
这实际上取决于你所谓的"实质性差异".区别在于一个人调用另一个,所以基本上是相同的东西,但在不同的上下文中使用.
以下是一个片段,defaults.properties用于定义标准Ant任务:
ant=org.apache.tools.ant.taskdefs.Ant
antcall=org.apache.tools.ant.taskdefs.CallTarget
...........
Run Code Online (Sandbox Code Playgroud)
如果打开这些任务的源代码,您将看到CallTarget包含一个Ant对象并将大部分工作委托给它:
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();
}
..........
..........
}
Run Code Online (Sandbox Code Playgroud)