开发者

Which Ant property contains the CWD when the ant script is run?

开发者 https://www.devze.com 2023-01-02 08:19 出处:网络
I don\'t want to get the basedir -- that appears to contain the build.xml script -- I want the CWD of the call to ant itself.

I don't want to get the basedir -- that appears to contain the build.xml script -- I want the CWD of the call to ant itself.

Basically, I want to do this:

$ cd /home/c开发者_如何学Chrisr/projects/some_project
$ ant -f ../../tools/ant-build-rules/library.xml build-library

At this point, I need two things:

  1. The path to ant-build-rules in absolute form; this is currently found in the basedir property, so I'm set there.
  2. The path of some_project, in absolute form. This is what I don't know how to get.

Which property contains this information?


The java property user.dir contains the current directory

<project name="demo" default="printCWD">
    <target name="printCWD">
        <echo message="${user.dir}"/>
    </target>
</project>


There is no such property, but you can run a script to get it.

${bsh:WorkDirPath.getPath()}

See urbancode.com.

0

精彩评论

暂无评论...
验证码 换一张
取 消