为什么Ant会识别某些env vars而不识别其他env vars

时间:2013-05-19 03:12:52

标签: java ant environment-variables

我定义了2个env vars:

myuser@mymachine:~$ echo $ANT_HOME
/home/myuser/apache/ant/1.8.4/apache-ant-1.8.4
myuser@mymachine:~$ echo $ANT_IVY_HOME
/home/myuser/apache/ivy/apache-ivy-2.3.0-rc2

我有以下Ant构建:

<property environment="env"/>

<target name="testant">
    <echo message="Ant home: ${env.ANT_HOME}"/>
    <echo message="Ant ivy home: ${env.ANT_IVY_HOME}"/>
</target>

当我运行testant时,我得到以下控制台输出:

Buildfile: /home/myuser/eclipse/workspace/myapp/build.xml
testant:
    [echo] Ant home: /home/myuser/apache/ant/1.8.4/apache-ant-1.8.4
    [echo] Ant ivy home: ${env.ANT_IVY_HOME}
BUILD SUCCESSFUL
Total time: 316 milliseconds

为什么Ant会识别ANT_HOME而不识别ANT_IVY_HOME?提前谢谢!

1 个答案:

答案 0 :(得分:2)

您是否仅设置ANT_IVY_HOME而非导出吗?