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

Reply via email to