如何指定基本目录然后我们像 ant -f somedir/dir/build.xml 一样运行 ant [英] How to specify base dir then we run ant like ant -f somedir/dir/build.xml

查看:21
本文介绍了如何指定基本目录然后我们像 ant -f somedir/dir/build.xml 一样运行 ant的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何指定基本目录然后我们像ant -f somedir/dir/build.xml一样运行ant.Ant 设置 basedir 相对于 build.xml,如果我指定

How to specify base dir then we run ant like ant -f somedir/dir/build.xml. Ant sets basedir relative to build.xml, if I specify

<project basedir="." ..>

我想让 basedir 指向执行 Ant 的地方.

I would like to have basedir pointed to place where Ant is executed.

推荐答案

使用 -D 覆盖 basedir 属性:

Use -D to override the basedir property:

ant -Dbasedir=`pwd` -f path/to/build.xml

pwd 的使用是 Linux 独有的,但如果你在另一个平台上,你总是可以把当前目录的绝对路径放在那里.

The use of pwd is a Linux-only thing, but you can always put the absolute path of the current directory there if you're on another platform.

我认为在 build.xml 中没有办法做到这一点,除了使用 ant 任务重新执行 ant.

I don't think there's a way to do this inside build.xml, short of re-executing ant with the ant task.

这篇关于如何指定基本目录然后我们像 ant -f somedir/dir/build.xml 一样运行 ant的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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