gpt4 book ai didi

ant - AntCall 和 Ant 任务有什么区别?

转载 作者:行者123 更新时间:2023-12-04 01:07:48 28 4
gpt4 key购买 nike

AntCall 任务(描述为 here )和 Ant 任务(描述为 here )之间是否有任何实质性区别,除了 Ant 任务在不同的构建文件上运行这一事实?

最佳答案

这实际上取决于您所说的“实质性差异”是什么意思。不同之处在于一个调用另一个,所以基本上是同一件事,但在不同的上下文中使用。

这是来自 defaults.properties 的片段它定义了标准的 Ant 任务:

ant=org.apache.tools.ant.taskdefs.Ant
antcall=org.apache.tools.ant.taskdefs.CallTarget
...........

如果你打开这些任务的源代码,你会看到 CallTarget包含 Ant对象并将大部分工作委托(delegate)给它:
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();
}
..........
..........
}

关于ant - AntCall 和 Ant 任务有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2756816/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com