Thanks for the info. Happy new year, Ceki
At 16:11 29.12.2000 -0500, you wrote:
>It would be nice for the 'if' logic to support compound conditionals:
>
>if="(condition1 and condition2) or condition3 and not condition4"
>
>Probably should get rid of the "unless" attribute altogether....
>
>etc.
>
>However, that is not currently the case.
>
>So, unfortunately, you are left with having to do things in a weird
>non-intuitive chained way, and you can't rely on having checked
>the variables in a one time, init step. This is because there is
>no conditional flow control, other than <available> and <uptodate>.
>
><target name="do_the_work" depends="check_jms_after_checking_jndi"
>if="jms-and-jndi-present">
>....
></target>
>
><target name="check_jms_after_checking_jndi" depends="check_jndi"
>if="jndi-present">
>
> <available classname="javax.jms.Message"
> property="jms-and-jndi-present"/>
></target>
>
><target name="check_jndi">
> <available classname="javax.naming.Context"
> property="jndi-present"/>
></target>
>
>Jason
>
>----- Original Message -----
>From: "Ceki Gulcu" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Wednesday, December 27, 2000 7:07 PM
>Subject: Two consequtive ifs
>
>
> >
> >
> > Hello,
> >
> > Sorry if this question has been already asked before. I have a target that
> > depends on the existence of JNDI and JMS libraries, as in:
> >
> > <project name="log4j" default="compile" basedir="." >
> > <target name="init">
> > <tstamp />
> > <property name="srcdir" value="." />
> > <property name="classes" value="classes" />
> > <property name="stem" value="org/apache/log4j" />
> > <property name="build.compiler" value="jikes"/>
> > <property name="version" value="1.0"/>
> >
> > <available classname="javax.jms.Message"
> > property="jms-present"/>
> >
> > <available classname="javax.naming.Context"
> > property="jndi-present"/>
> > </target>
> >
> > ... removed stuff
> >
> > <target name="compile.jms" depends="init" if="jms-present">
> > <echo message="Really compiling JMS dependent code." />
> > <javac
> > srcdir="${srcdir}"
> > destdir="${classes}"
> > includes="${stem}/net/JMS*.java"
> > classpath="${classpath}"/>
> > </target>
> > </project>
> >
> > However, since ANT does not allow two consecutive if attributes, I can
> only
> > check for the presence of JMS. How can I check for the presence of JNDI
> and
> > execute the "compile.jms" target only if both JMS and JNDI are present?
> > Thanks in advance for your help, Ceki
> >