Alex Rivera | Logout

ant machine name property

Asked 2009-07-28T21:57:59.953
31

Is there a way to get the machine name as ant property, for both Linux and Windows OS.

Edit
Report

2 Answers

3

Copy the value for Unix into the Windows version. Then you can use ${env.COMPUTERNAME}.

<property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>
answered 2009-07-28T22:07:05.130
2

You can use the environment variables $HOSTNAME (UNIX) and %COMPUTERNAME% (Windows) for this. You can check to see if the environment variable HOSTNAME has been defined and, if not, you can then use the environment variable COMPUTERNAME, assuming it is defined. As a fallback, you can use "unknown".

answered 2009-07-28T22:06:28.033

Your Answer