我的问题是;
当我调用一个以上的 antcallback 函数时,它总是返回相同的值。查看以下代码:
<project name="AntCallBack" default="testFnc" basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<target name="acbFnc" description="Sub Function" >
<echo message="[acbFnc] started"/>
<property name="out.file" value="${in.file}"/>
<echo message="[acbFnc] ended."/>
</target>
<target name="testFnc" description="Main" >
<antcallback target="acbFnc" return="out.file" >
<param name="in.file" value="TEST-1" />
</antcallback>
<echo message="CALL - 1 : out.file : ${out.file}" />
<antcallback target="acbFnc" return="out.file" >
<param name="in.file" value="TEST-2" />
</antcallback>
<echo message="CALL - 2 : out.file : ${out.file}" />
</target>
</project>
结果是:
$ /home/apache-ant-1.9.4/bin/ant -f AntCallBackTest.xml
Buildfile: AntCallBackTest.xml
testFnc:
acbFnc:
[echo] [acbFnc] started
[echo] [acbFnc] ended.
[echo] CALL - 1 : out.file : TEST-1
acbFnc:
[echo] [acbFnc] started
[echo] [acbFnc] ended.
[echo] CALL - 2 : out.file : TEST-1
BUILD SUCCESSFUL
Total time: 0 seconds
如您所见,我在第一次通话中
发送了“param name="in.file" value="TEST-1"”,在第二次通话中发送了“param name="in.file" value="TEST-2"”,
但它总是返回第一个值:
[echo] CALL - 1 : out.file : TEST-1
[echo] CALL - 2 : out.file : TEST-1
我究竟做错了什么?
提前致谢