adding absolute path but keeping relative paths intact
hi i have an existing ant script build.xml
that has all the paths as relative paths.
I was wondering if i could add a line or somewhere that will allow me to add an absolute path so that i can leave the relative paths intact and work?
i tried adding basedir="C:\Work\"
to <project>
but it doesnt work.
for example,
in my build.xml
i have:
<exec executable="Build\file.exe">
and this build\file.exe
is located in C:\Work\build\file.exe
. However, if i use a console application to run C:\Work\ant.bat
which will trigger my build.xml
(ant script) and this
<exec executable="Build\file.exe">
would not function. Hence i would like to add a absolute path to my script so that i can keep 开发者_如何学运维all my relative paths intact. Anybody knows of any possible ways to do it?
Assuming all the problem paths are used in exec
as you have shown, you could resolve this by setting your PATH
environment variable to the full path to the dir containing Build
, e.g.
set PATH=C:\Work;%PATH%
This way, the operating system will resolve the path for you.
However, it might be simpler to use a text editor to do a global find/replace so you can use an absolute path in your build file, e.g.
<property name="build.tools.dir" value="C:/Work"/>
<exec executable="${build.tools.dir}/Build/file.exe"/>
精彩评论