ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Getting environment variable on Linux or Windows ?
Date Wed, 07 Mar 2001 15:29:52 GMT
Olivier Prouvost <olivier.prouvost@anyware-tech.com> wrote:

> I'm trying to get the 'HOME' environment variable with ant, using
> linux and windows.

> <property name='HOME' environment="Linux" value="Linux.HOME"/> ???
> Does not work.

No, Linux is a prefix to the name of the properties created from your
environment variables. All environment variables will be transformed
into properties at once

<project default="test" basedir=".">
  <target name="test">
    <property environment="Linux" />
    <echo message="${Linux.HOME}" />
  </target>
</project>

works:

bodewig@bodewig ~/jakarta/jakarta-ant >ant -f /tmp/env.xml 
Buildfile: /tmp/env.xml

test:
     [echo] /home/bodewig

BUILD SUCCESSFUL

Total time: 2 seconds

Stefan

Mime
View raw message