I'm a relative newcomer to Ant - only been writing build.xml files for about
8 months.  To avoid huge lists of unresolved symbols at compile time, I
provide checking for the presence of required jar files prior to kicking off
the compile step.  I've put a shortened version of the relevant section from
my build.xml at the end of this message.  The issue I have is that in order
to do this, I've had to list my jar files 3 different times: for the echo,
for the condition, and finally for the classpath.  My actual set of jars is
much longer, so this becomes a maintenance headache.  Is there any way I can
accomplish the same thing without repeating the set of files?  I can of
course use a fileset for the classpath, but from what I read in the Ant
manual, there is no way to use a fileset for either the echo task or the
condition task.  I appreciate all pointers.

   <target name="checkinputjars">
      <echo>Checking for required input jars</echo>
      <echo>"${deploy_dir}/lib/xml.jar"</echo>
      <echo>"${deploy_dir}/lib/jce1_2_1.jar"</echo>
      <echo>"${deploy_dir}/lib/sunjce_provider.jar"</echo>
      <condition property="inputjarsavailable">
         <and>
            <available file="${deploy_dir}/lib/xml.jar"/>
            <available file="${deploy_dir}/lib/jce1_2_1.jar"/>
            <available file="${deploy_dir}/lib/sunjce_provider.jar"/>
         </and>
      </condition>
   </target>

   <target name="inform_no_input_jars" depends="checkinputjars"
unless="inputjarsavailable">
      <fail message="ERROR! Could not find the required input JAR files"/>
   </target>

   <target name="build" depends="inform_no_props, inform_no_input_jars,
init">
      <javac debug="on" destdir="${build}">
         <classpath>
            <pathelement location="${deploy_dir}/lib/xml.jar"/>
            <pathelement location="${deploy_dir}/lib/jce1_2_1.jar"/>
            <pathelement location="${deploy_dir}/lib/sunjce_provider.jar"/>
         </classpath>
      </javac>
   </target>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to