ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <jakarta-...@ehatchersolutions.com>
Subject Re: Accessing system variables
Date Wed, 23 Oct 2002 01:48:46 GMT
<property environment="env"/> will give you ${env.ANT_HOME}, but you'd 
be better off using ${ant.home}.

Follow it with:

     <property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>

And you'll get the computer name on both Windows and *nix platforms.

Two caveats to the above that I know of:

- IDEA IntelliJ does not set ${ant.home} (at least not in my version) so 
I have a fall back setting of it in my build files.

- Mac OS X does not have HOSTNAME set, although I just this very minute 
realized that there is a HOST environment variable!  Maybe that will 
solve my problems by adding another property setting statement or 
something like that.

	Erik


Christian Cryder wrote:
> Is there anyway to access system variables within Ant? For instance, I'd
> like to do this:
> 
>     <echo message="ANT_HOME defined as ${env.ANT_HOME}" />
> 
> I'd also like to know if there is anyway to retrieve the host/computer name
> from within Ant?
> 
> Thanks,
> Christian
> ----------------------------------------------
> Christian Cryder [christianc@atmreports.com]
> Internet Architect, ATMReports.com
> Barracuda - http://barracuda.enhydra.org
> ----------------------------------------------
> "Coffee? I could quit anytime, just not today"
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
> 
> 


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message