get hostname in ant easily

After searching a while, here is the best way I found to get the hostname in a propert. Just use exec task :

<exec dir="${basedir}" executable="hostname" outputproperty="">

The trick is the attribute outputpropety of the exec task. You can then use ${} variable to use the hostname in your ant scripts.


About this entry