0

我有一个需要在父目录中运行的 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 构建文件

4

1 回答 1

0

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

<property file="MyProject/local_build.properties" /> 
于 2012-10-19T17:43:23.413 回答