Folks i have two questions 1. I want to check whether an environment variable is defined or not. e-g i want to check whether the variable JAVA_HOME is set or not. How can i do that. Currently the way i am doing that is :
<property environment="env"/> <property name="java_home" value="${env.JAVA_HOME}"/> <target name="all"> <condition property="*java.is.not.set*"> * <contains string="${java_home}" substring="JAVA_HOME"/> // the line doing it* </condition> <antcall target="do_if_java_is_true"/> <antcall target="do_if_java_is_false"/> </target> so in the highlighted line, i am checking the whether the variable $java_home contains JAVA_HOME or not. If it does, then it means that JAVA_HOME is not set else it is set. Now i want to ask that is it the right way to check or is there any better way? 2. The second question is that based on the above condition, i want to execute separate targets. i-e if JAVA_HOME is set, then execute a different target, else execute a different task. The way i am doing it is i am calling i am calling two antcall as * <antcall target="do_if_java_is_true"/>* * <antcall target="do_if_java_is_false"/>* <target name="do_if_java_is_false" if="java.is.not.set" depends="compile,jars,clean> </target> <target name="do_if_java_is_true" unless="java.is.not.set" depends="javaspecific,compile,jars,clean> </target> Now, the problem is that though i am able to detect somehow that whether java is defined or not. But it executes both the targets i-e the "depends" attribute of both the targets gets executed whereas i dont want the depends attribute of both the target to be executed.... Can any help how can i correct Or do it more elegantly?? -- Kamran Hameed hpc.seecs.edu.pk/~kamran