ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
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

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 <ddevienne@lgc.com>     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:vilya.harvey@digitalsteps.com] 
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" <lcobo@cover-all.com>
To: "Ant Users List (E-mail)" <ant-user@jakarta.apache.org>
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:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message