【问题标题】:In Ant - how to use one property as value of another property?在 Ant 中 - 如何使用一个属性作为另一个属性的值?
【发布时间】:2014-05-01 07:27:37
【问题描述】:

基于一个条件,我希望一个属性具有一个值或另一个值。该属性的最终值作为输入参数发送到另一个脚本。

<condition property="localdir" value="../Utils">
    <equals arg1="${isGlobal}" arg2="false"/>
</condition>
<condition property="localdir" value="Utils">
    <equals arg1="${isGlobal}" arg2="true"/>
</condition>
<echo message="localdir after condition is ${localdir}" />

<target name="build_common" description="build common">
    <ant inheritAll="false"  antfile="../Utils/super_build.xml" target="build" >
    <!--line-10-->  <property name="basedir" value="${localdir}"/>          
    </ant>
</target>

localdir 的回显显示正确的值。但是上面第 10 行中的 basedir 没有正确设置。这里的脚本有错误吗? 我正在使用 Ant 1.8.3。

【问题讨论】:

    标签: ant properties


    【解决方案1】:

    尝试在你的 ant 任务中设置 useNativeBasedir="true":

    <target name="build_common" description="build common">
       <ant inheritAll="false"  antfile="../Utils/super_build.xml" target="build" useNativeBasedir="true">
       <!--line-10-->  <property name="basedir" value="${localdir}"/>          
       </ant>
    </target>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-29
      • 2020-10-19
      • 1970-01-01
      • 1970-01-01
      • 2015-02-11
      • 1970-01-01
      • 2017-08-20
      • 2020-07-19
      相关资源
      最近更新 更多