Here's a <script> equivalent. --DD

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

test:
     [echo] hostname = DDEVIENNE2

BUILD SUCCESSFUL
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 <[EMAIL PROTECTED]>     December 2002
  -->
<project name="hostname" default="test" basedir=".">

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

</project>

P:\org_apache\antx>

-----Original Message-----
From: Vilya Harvey [mailto:[EMAIL PROTECTED]] 
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.

Vil.
 
----- Original Message -----
From: "Luis Andrei Cobo" <[EMAIL PROTECTED]>
To: "Ant Users List (E-mail)" <[EMAIL PROTECTED]>
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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to