ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: Any way to get at the machine name?
Date Tue, 25 Jan 2005 16:41:11 GMT
Hello, here some names to get it:
1) Using hostname command. I have tested the following
snippet only on Linux:
<exec executable="hostname" dir="${basedir}"
    outputproperty="exec.hostname"/>
<echo>$${exec.hostname} is ${exec.hostname}</echo>
2) Using environmant variables (again testes only on
linux).
<property environment="env"/>
<echo>$${env.hostname} is ${env.HOSTNAME}</echo>
3) Using scriptdef and java.net package:
<scriptdef name="script.hostname"
language="javascript">
    <attribute name="property"/>
    <![CDATA[
       importPackage(java.net);
       address = InetAddress.getLocalHost();
       name = address.getHostName();
project.setNewProperty(attributes.get("property"),
name);
    ]]>
</scriptdef>
<script.hostname property="script.hostname"/>
<echo>$${script.hostname} is ${script.hostname}</echo>

HTH Ivan

--- galenboyerdev@hotpop.com wrote:

> I don't see this in the available properties?
> 
> Thanks.
> -- 
> Galen Boyer
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

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


Mime
View raw message