我是蚂蚁的总菜鸟,但或多或少我知道它是如何运作的。我遇到了一种我无法理解的情况,我将不胜感激。 这有点长,抱歉。我试图让它尽可能清楚。
我有一组像这样工作的目标:我会用“ - ”代替“依赖”:
- B - D - E - E1 - E2 unless property2 - E3 If property3 - E4 unless property4 - E5 - E6
doc-contracts
- C - E - E1 - E2 unless property2 - E3 If property3 - E4 unless property4 - E5 - E6
万一有点令人困惑,“doc-contracts”依赖于B和C,两条路径最终都会调用目标E.
这是“doc-contracts”的代码:
<target
name="doc-contracts"
depends="B,C"
description="Generates the documentation for contracts and annotations"
>
<foreach
target="doc-contracts-single"
param="doc-contracts-single.file"
inheritall="true"
>
<path>
<fileset dir="${properties.src.dir}">
<include name="*/*.csv"/>
</fileset>
</path>
</foreach>
</target>
基本上,对于每个csv,它将调用目标“doc-contracts-single”。 “doc-contracts-single”需要在目标E中设置的路径引用“pathReference”。
问题是,当我运行“doc-contracts”时,我得到了这个输出:
E6
E5
E4
E2
E1
E
D
B
C
doc-contracts
doc-contracts-single
ERROR: Reference pathReference has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may
support referencing ids defined in non-executed targets.
doc-contracts-single
ERROR: Reference pathReference has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may
support referencing ids defined in non-executed targets.
END
我有两个问题:
正如你所看到的,它只通过E一次,我不知道为什么。我可以理解,一旦第一个“分支”(B及其所有依赖树)流动 如果设置了property2,则可以在E2中断(我很确定,这是正在发生的事情)。但是代码应该至少再次通过E和E1,因为那些2 任务没有任何条件,不是吗?我已经将回声放在所有目标中,它根本不会进入目标E和E1。根据我的理解,我应该得到这个输出:
E6
E5
E4
E2
E1
E
D
B (end of "first branch", which would be B and the chain of targets it generates)
E1
E
C (end of "first branch", which would be B and the chain of targets it generates)
doc-contracts
doc-contracts-single
ERROR: Reference pathReference has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may
support referencing ids defined in non-executed targets.
doc-contracts-single
ERROR: Reference pathReference has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may
support referencing ids defined in non-executed targets.
... (once for each .csv it finds)
END
这是对的吗?我想知道蚂蚁流是如何运作的吗?
使用ant 1.7 - &gt;引用pathReference尚未在运行时设置,但在构建文件解析期间找到,尝试解析。 Ant的未来版本可能 支持在非执行目标中定义的引用ID。
使用ant 1.9 - &gt;蚂蚁1.7中的消息预期出错
我已经回应了“pathReference”的内容,它看起来很好并且定义得很好,直到目标“doc-contracts”称为“doc-contracts-single”。在“doc-contracts-single”里面 参考丢失了。任何人都可以向我解释原因吗?我认为,当您在项目中设置路径引用时,可以在其余部分中使用它 该项目。我只能考虑两个选项:
1-脚本的某些部分正在删除它的内容,我找不到哪一行正在执行此操作
或
2-因为“doc-contracts”和“doc-contracts-single”与“depends”无关(相反,一个调用另一个),它们在不同的范围内,并且用一个设置的引用不可见 从另一个。
抱歉这么长的帖子。我尽力解释问题尽可能清楚。提前感谢您的回答!