如何在蚂蚁属性中接取财产 [英] How to acess property within a property in ant
问题描述
大家好,请给看看这个code
在我的属性文件,我有
双赢x86.pc-共享位置= E:\\ Ant_Scripts
现在下面我想从我的build.xml调用 PrintInstallerName_build
,而为 PrintInstallerName_build
处于测试。 XML。在build.xml文件, $ {} platform.id具有价值=赢得86
在调用的目标,并在所谓的目标参数1还具有价值=赢得86
<目标名称=PrintInstallerName>
<回声> PlatForm.Id ====> $ {platform.id}< /回声>
<蚂蚁antfile =的test.xml目标=PrintInstallerName_build>
<属性名=参数1值=$ {} platform.id/>
< /蚂蚁>
<目标名称=PrintInstallerName_build>
<回声> $ {param1.pc-共享位置}< /回声><! - $ {param1.pc共享定位} - >
<回声> $ {}参数1 .PC-共享位置}< /回声><! - 双赢x86.pc - 共享位置 - >
<回声> $ {共赢x86.pc-共享位置}< /回声>< - 电子:\\\\ Ant_Scripts - >
< /目标与GT;
,你只能看到最后一条语句给出正确的输出,但它是很难codeD,我想使用参数1,输出应 E:\\\\ Ant_Scripts
我试图用$ @和,但没有工作,可能是我做错了什么地方有人可以帮助请,我打,明天就是它的DOD。
<目标名称=PrintInstallerName_process>
<回声> $ {参数1}< /回声><! - 双赢86 - > < macrodef NAME =测试>
<属性名=V默认为未设置/>
<元素名称=一些任务选项=YES/>
<&连续GT;
<回声>将$源代码目录{}参数1:$ {@ {V}}< /回声>< - 的Win-86的目录:E:\\ Ant_Scripts - >
<有的任务/>
< /顺序>
< / macrodef> <测试V =$ {}参数1 .PC-共享位置>
<有的任务> < /有的任务>
< /测试>
< /目标与GT;
这是它的工作方式,对我来说工作正常,反正 @须藤code
你的小费把我有那么非常感谢你。
Hi all please give a look to this code
in my properties file i have win-x86.pc-shared-location=E:\Ant_Scripts
Now below i am trying to call PrintInstallerName_build
from my build.xml,while as PrintInstallerName_build
is in test.xml. In build.xml file,${platform.id} has value=win-x86
in the calling target and in called target param1 also has value=win-x86
<target name="PrintInstallerName" >
<echo>PlatForm.Id====>${platform.id}</echo>
<ant antfile="test.xml" target="PrintInstallerName_build">
<property name="param1" value="${platform.id}"/>
</ant>
<target name="PrintInstallerName_build" >
<echo>${param1.pc-shared-location}</echo><!--${param1.pc-shared-location}-->
<echo>${param1}.pc-shared-location}</echo><!--win-x86.pc-shared-location-->
<echo>${win-x86.pc-shared-location}</echo><!--E:\\Ant_Scripts-->
</target>
as you can see only the last statement gives correct output but it is hardcoded,i want to use param1 and the output should be E:\\Ant_Scripts
i tried to use $ and @ but none works,may be i am doing wrong somewhere can someone help please,i am struck and tomorrow is its DOD.
<target name="PrintInstallerName_process" >
<echo>${param1}</echo><!--win-x86-->
<macrodef name="testing">
<attribute name="v" default="NOT SET"/>
<element name="some-tasks" optional="yes"/>
<sequential>
<echo>Source Dir of ${param1}: ${@{v}}</echo><!-- Dir of Win-x86:E:\Ant_Scripts-->
<some-tasks/>
</sequential>
</macrodef>
<testing v="${param1}.pc-shared-location">
<some-tasks>
</some-tasks>
</testing>
</target>
this is the way it works and for me it works fine anyways @sudocode
your tip took me there so thank you very much
这篇关于如何在蚂蚁属性中接取财产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!