I'm using a build.xml file that has the following <path> in it: <path id="compile.classpath"> <pathelement location="${basedir}"/>
<fileset dir="${basedir}/lib" > <include name="*.jar" /> </fileset> <!-- Include all elements that Tomcat exposes to applications --> <pathelement location="${catalina.home}/common/classes"/> <fileset dir="${catalina.home}/common/endorsed"> <include name="*.jar"/> </fileset> <fileset dir="${catalina.home}/common/lib"> <include name="*.jar"/> </fileset> <pathelement location="${catalina.home}/shared/classes"/> <fileset dir="${catalina.home}/shared/lib"> <include name="*.jar"/> </fileset> </path> This only works for tomcat 1.5 and below, I think, which have the "common" and "shared" folders in the tomcat root directory (tomcat 1.6 and up have a "lib" folder only under the tomcat root). This build.xml needs to be used by people running old and new Tomcat versions, so I want to be able to check for these directories, and only include them if they are present (otherwise the ant script doesn't work), and otherwise run the equivalent of: <path id="compile.classpath"> <pathelement location="${basedir}"/> <fileset dir="${basedir}/lib" > <include name="*.jar" /> </fileset> <fileset dir="${catalina.home}/lib"> <include name="*.jar"/> </fileset> </path> But I'm having no luck accomplishing this. Is this possible? If so, how? If this makes no sense to try and do, what am I missing and how should I accomplish this? Thanks.