获取并通过ANT使用父目录 [英] Getting and using parent directory through ANT

查看:224
本文介绍了获取并通过ANT使用父目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个目录结构和放大器; build.xml文件这样

I have a directory structure & build.xml like this

    /path-to-project/src/prj1
    /path-to-project/src/prj2

    /path-to-project/tests
    /path-to-project/tests/build.xml

我必须以某种方式获取路径

I have to somehow get the path

    /path-to-project/

在我的build.xml

in my build.xml

我的build.xml文件是这样的

My build.xml is like this

<project name="php-project-1" default="build" basedir=".">
  <property name="source" value="src"/>
    <target name="phploc" description="Generate phploc.csv">
      <exec executable="phploc">
        <arg value="--log-csv" />
        <arg value="${basedir}/build/logs/phploc.csv" />
        <arg path="${source}" />
      </exec>
    </target>
</project>

在这里,我有点想获得 $ {来源} /路径到项目/ src目录/ 但我不跟 $得到它{parent.dir}

是否有可能在build.xml得到这个路径?

Is it possible to get this path in the build.xml?

推荐答案

您可以使用 .. 就像你做的命令行导航到父目录

You can use .. just as you do on the command-line to navigate to the parent directory.

<project name="php-project-1" default="build" basedir=".">
  <property name="root.dir" location=".."/>
  <property name="source" location="${root.dir}/src"/>
  ...
</project>

更新:更改位置按马丁的回答,你应该接受

Update: Changed value to location as per martin's answer which you should accept.

这篇关于获取并通过ANT使用父目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆