- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在Ant中,我想定义一个定义属性的目标(称为A
),并从另一个目标(称为antcall
)对其进行B
。我希望目标B
在调用目标A
之后,可以访问目标A
中定义的属性。
例如:
<target name="B">
<antcall target="A" inheritAll="true" inheritRefs="true" />
<echo>${myprop}</echo>
</target>
<target name="A">
<property name="myprop" value="myvalue" />
</target>
<echo>${myprop}</echo>
不打印
myvalue
(我认为是因为
myprop
中未定义
B
属性)。
最佳答案
<target name="cond" depends="cond-if"/>
<target name="cond-if" if="prop1">
<antcall target="cond-if-2"/>
</target>
<target name="cond-if-2" if="prop2">
<antcall target="cond-if-3"/>
</target>
<target name="cond-if-3" unless="prop3">
<echo message="yes"/>
</target>
Note: <antcall> tasks do not pass property changes back up to the environment they were called from, so you wouldn't be able to, for example, set a result property in the cond-if-3 target, then do <echo message="result is ${result}"/> in the cond target.
antcallback
:AntCallBack与标准的“antcall”任务相同,除了它允许在被调用目标中设置的属性在调用目标中可用。
<target name="testCallback" description="Test CallBack">
<taskdef name="antcallback" classname="ise.antelope.tasks.AntCallBack" classpath="${antelope.home}/build" />
<antcallback target="-testcb" return="a, b"/>
<echo>a = ${a}</echo>
<echo>b = ${b}</echo>
</target>
<target name="-testcb">
<property name="a" value="A"/>
<property name="b" value="B"/>
</target>
关于ant - Ant antcall定义属性的目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5275682/
我想使用 ant 脚本基于 .composites 构建几个项目。我在我的 build.xml 文件中添加了所有 taskref 标签、lib 路径。我为此编写了以下代码,但出现错误foreach 不
我有一个构建脚本,作为该脚本的一部分,它将一个 jar 文件复制到一个目录,为了方便起见,我们将其称为 utils jar。 utils jar 是由位于另一个目录中的另一个构建脚本构建的。我正在尝试
我对 Ant 相当陌生,但我体验过创建通用 ant 目标是一种非常好的模式,这些目标将通过具有不同参数的 antcall 任务进行调用。 我的例子是编译目标,它使用复杂的构建命令来编译多个系统,每个系
在定义顺序构建步骤时,我使用 target 元素的 depends 属性。我最近看到了一个 ant 文件,其中构建序列由目标内的 antcall 元素定义。举例说明: ... 对 ... 这两种
我有两个 Ant 文件: 1) 主文件 2) 实用程序文件 当我调用 firstTarget它说它找不到 thirdTarget . 如果我更改 seco
AntCall 任务(描述为 here )和 Ant 任务(描述为 here )之间是否有任何实质性区别,除了 Ant 任务在不同的构建文件上运行这一事实? 最佳答案 这实际上取决于您所说的“实质性差
我有一个在 Eclipse 中运行的 Ant 脚本,它在控制台中输出,如下所示: buildStuff: [echo] Building doStuff: syncStuff:
我正在尝试从命令行构建我的 android 应用程序,我有一个脚本 Ant 发布 失败于 BUILD FAILED android-sdk-macosx/tools/ant/build.xml:473
我是一名优秀的程序员,十分优秀!