ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Localhost name
Date Thu, 12 Dec 2002 16:42:03 GMT
Here's a <script> equivalent. --DD

P:\org_apache\antx>%ANT_HOME%\bin\ant -f hostname-script.xml
Buildfile: hostname-script.xml

     [echo] hostname = DDEVIENNE2

Total time: 2 seconds
P:\org_apache\antx>type hostname-script.xml
<?xml version="1.0"?>

<!-- ANT build file to test a specific feature or bug of ANT.
     Dominique Devienne <>     December 2002
<project name="hostname" default="test" basedir=".">

  <target name="test">
    <script language="javascript"><![CDATA[
      hostname =;
      self.getProject().setNewProperty("hostname", hostname);
    <echo message="hostname = ${hostname}" />



-----Original Message-----
From: Vilya Harvey [] 
Sent: Thursday, December 12, 2002 10:38 AM
To: Ant Users List
Subject: Re: Localhost name

Where I work, we couldn't find a way to do this. So we implemented our own
task to do it for us. The implementation itself was trivial (just call
InetAddress.getLocalHost().getHostName() in the execute() method and store
it in a user-specified property), but I can see about making it available if
you (or anyone else) is interested.

----- Original Message -----
From: "Luis Andrei Cobo" <>
To: "Ant Users List (E-mail)" <>
Sent: Thursday, December 12, 2002 4:03 PM
Subject: Localhost name

> Is there a way, in Ant, without specifying some startup variable or hard
> coding a property, to get the machine name for localhost that the buld
> script is running on?
> Luis Andrei Cobo

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message