【问题标题】:When setting the basedir to the parent directory the tokens are not replaced correctly将 basedir 设置为父目录时,令牌未正确替换
【发布时间】:2012-10-19 17:25:00
【问题描述】:

我有一个需要在父目录中运行的 Ant 任务。当我将 basedir 设置为父目录时,令牌没有被正确替换。

<project name="Flex Ant Tasks Build Script" default="compileFlex" basedir="../"> 

    <!-- load previously defined configuration properties file --> 
    <property file="local_build.properties" /> 

    <!-- delete and create the DEPLOY dir again --> 
    <target name="init">
        <delete dir="${DEPLOY_DIR}" /> 
        <mkdir dir="${DEPLOY_DIR}" /> 
    </target> 

以及构建属性:

// this is the folder we want to publish the swf to 
DEPLOY_DIR = ${basedir}/output

当 basedir 设置为“.”时结果是:

[mkdir] Created dir: /Users/me/Documents/projects/MyProject/output

当我将 basedir 设置为父级时,“../”结果是:

[mkdir] Created dir: /Users/me/Documents/projects/${DEPLOY_DIR}

想要的结果是:

[mkdir] Created dir: /Users/me/Documents/projects/output

注意
构建脚本位于:

/Users/me/Documents/projects/MyProject/

因为我似乎无法在 Eclipse 项目之外导入任何 ANT 构建文件

【问题讨论】:

    标签: ant


    【解决方案1】:

    问题是当我进入一个目录时,属性文件的路径变得无效。所以 ${DEPLOY_DIR} 永远不会被定义。如果我上一个目录,我需要为它提供构建属性文件的正确路径:

    <property file="MyProject/local_build.properties" /> 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-28
      • 2017-06-25
      • 1970-01-01
      • 2015-02-02
      相关资源
      最近更新 更多