Ant: test environment variable
May 09, 2008 22:49:17 Last update: May 09, 2008 22:50:45
I'm trying to generate a web service proxy using Axis2. In my
build.xml file I want to make sure that the AXIS2_HOME environment variable is set to where Axis2 is installed. Otherwise, fail the build with a message. Here's the relevant sections in my build.xml:
<property environment="env"/> <target name="gen-proxy-axis2" depends="check-axis2" if="env.AXIS2_HOME"> <property name="axis2.home" location="${env.AXIS2_HOME}"/> <echo message="Axis2 home: ${axis2.home}"/> <!-- generate the proxy here... --> </target> <target name="check-axis2" depends="init" unless="env.AXIS2_HOME"> <fail message="Please set AXIS2_HOME to where axis 2 is installed"/> </target>