Getting Ant <javac> to Recognize Class Path
I have an Apache Ant build file with the <javac> command, which requires four specific JAR files to build the classpath . I tried to do this:
<project basedir=".." default="build_to_jar" name="Transnet Spectrum Analyzer"> <property environment="env"/> <property name="src" value="src"/> <property name="libsrc" value="library_sources" /> <property name="build" value="build"/> <property name="dist" value="dist"/> <property name="target" value="1.5"/> <property name="libraries" value="./libraries"/> <fileset dir="." id="TSA.classpath"> <include name="${libraries}/rxtx/RXTXcomm.jar" /> <include name="${libraries}/commons-logging-1.1.1.jar" /> <include name="${libsrc}/JCommon/jcommon-1.0.15.jar" /> <include name="${libsrc}/JFreeChart/jfreechart-1.0.12.jar" /> </fileset> <target name="compile" depends="clean,init" description="compile the source " > <echo>Compile from ${src} to ${build}</echo> <javac destdir="${build}" source="${target}" target="${target}"> <compilerarg value="-Xlint:unchecked"/> <src path="${src}"/> <classpath path="TSA.classpath" /> </javac> </target> <!-- blah blah blah --> </project> ... but not one of the files specified in TSA.classpath appears. How to include these files in my classpath?
+41
Paul Fisher Apr 6 '09 at 19:18 2009-04-06 19:18
source share3 answers
Here is an example from a project that I am currently working on. I suspect that you can change it to work in your situation.
<path id="master-classpath"> <fileset dir="${web.dir}/WEB-INF/lib"> <include name="*.jar"/> </fileset> <fileset dir="${appserver.lib}"> <include name="servlet*.jar"/> </fileset> <pathelement path="${build.dir}"/> </path> ... <javac destdir="${build.dir}"> <src path="${src.dir}"/> <classpath refid="master-classpath"/> </javac> +67
William Brendel Apr 6 '09 at 19:22 2009-04-06 19:22
source shareTry the following:
<classpath refid="TSA.classpath"/> +14
TofuBeer Apr 6 '09 at 19:21 2009-04-06 19:21
source shareTry
<javac ... classpathref="TSA.classpath"> or
<javac ...> ... <classpath refid="TSA.classpath" /> </javac> +14
Joachim Sauer Apr 6 '09 at 19:21 2009-04-06 19:21
source share