将basedir设置为父目录时,标记不会被正确替换

时间:2012-10-19 17:25:01

标签: ant

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

1 个答案:

答案 0 :(得分:0)

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

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