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?
+1
A:
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.
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
...........
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();
}
..........
..........
}
dpb
2010-05-03 11:43:28