This task shows the hostname or IP address of the local machine.
To use this task in your build files, include a task definition like this:
    <taskdef name="hostname" classname="ise.antelope.tasks.HostnameTask"/>
   
Table 16.1. Hostname Task Attributes
| Attribute | Description | Default | Required | 
|---|---|---|---|
| property | Name of the property to store the hostname or IP | hostname | No | 
| showip | If true, get the IP address of the local machine. | false | No | 
| nic | The specific name of an interface to get the hostname or IP address of. | None | No | 
| showall | Get all names or IP addresses for all network interfaces on the local machine. | false | No | 
| failonerror | Should the build fail if this task fails? | false | No | 
Examples:
   <description>
      Unit tests for hostname task, not really good as hostname is machine
      dependent, so writing a portable test is hard.
   </description>
   <target name="test1">
      <a:unset name="hostname"/>
      <a:hostname/>
      <echo>hostname: ${hostname}</echo>
      <a:assert name="hostname" exists="true" message="test 1 failed."/>
   </target>
   <target name="test2">
      <a:unset name="localhost"/>
      <a:hostname property="localhost"/>
      <echo>localhost: ${localhost}</echo>
      <a:assert name="localhost" exists="true" message="test 2 failed."/>
   </target>
   <target name="test3">
      <a:unset name="localhost"/>
      <a:hostname property="localhost" showall="yes"/>
      <echo>all interfaces: ${localhost}</echo>
      <a:assert name="localhost" exists="true" message="test 3 failed."/>
   </target>
   <target name="test4">
      <a:unset name="localhost"/>
      <a:hostname property="localhost" showall="yes" showip="yes"/>
      <echo>all interfaces by IP: ${localhost}</echo>
      <a:assert name="localhost" exists="true" message="test 4 failed."/>
   </target>
   <target name="test5">
      <a:unset name="localhost"/>
      <a:hostname property="localhost" nic="lo" showip="yes"/>
      <echo>nic lo: ${localhost}</echo>
      <a:assert name="localhost" value="lo:127.0.0.1" message="test 5 failed."/>
   </target>
Output:
test1:
     [echo] hostname: blackdog
test2:
     [echo] localhost: blackdog
test3:
     [echo] all interfaces: lo:127.0.0.1, eth0:, eth1:blackdog.somewhere.com, eth2:blackdog.wireless.somewhere.com
test4:
     [echo] all interfaces by IP: lo:127.0.0.1, eth0:, eth1:192.168.1.3, eth2:192.168.44.12
test5:
     [echo] nic lo: lo:127.0.0.1