I am trying to compile a source tree where I have all my external libs
bundled into a single file, lib.jar. After reading "Installing Ant",
"Using Ant", and most of "Developing with Ant" sections of the manual, I
have it mostly working. When compiling, I get errors that imply that javac
does not see the jar file. So, I'm figuring I used the <classpath> element
incorrectly. Could someone check this for me?
For my initial testing, I have lib.jar and build.xml in the parent
directory of all the top level source where you can see "com", "org", etc.
So, I am setting src, classpath, and destdir to this directory. From this
same directory, I also run ant.
I'd appreciate any help anyone could offer,
Joseph
--------------------------------------------
<?xml version="1.0"?>
<project name="PBS" default="dist" basedir=".">
<!-- set global properties for this build -->
<property name="src" value="."/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="classpath" value="."/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}">
<classpath>
<pathelement path="${classpath}"/>
<fileset dir=".">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target name="dist" depends="compile">
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file
-->
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>