ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ellsworth <sc...@alodar.com>
Subject A path form that both zipfileset and classpath like!
Date Tue, 14 May 2002 20:17:53 GMT
Hi, all.

I just figured this out, and wanted to share with others needing to 
bundle known jars into the output.

Assume my project has a "libraries" dir.
Assume I want to compile against "/disk/libraries/a.jar" and 
"/disk/libraries/b.jar".
Assume further that I want to bundle all of these up in the final jar:

compile.library.dir is set to "/disk/libraries"
compile.library.classpath is set to "a.jar, b.jar"

To bundle:

   <target name="jar-no-manifest">
     <mkdir dir="${jar.dist}"/>
     <jar
       jarfile="${jar.dist}/${jar.baseName}.jar"
       compress="${jar.compress}">
       <zipgroupfileset dir="${compile.library.dir}" 
includes="${jar.extra.library.zip}"/>
       <fileset dir="${compile.classes}"/>
     </jar>
   </target>

To compile:

   <target name="compile" depends="depend">
     <javac
       debug="${compile.debuginfo}"
       optimize="${compile.optimize}"
       deprecation="${compile.deprecation}"
       srcdir="${compile.source}"
       destdir="${compile.classes}"
       excludes="${compile.excludedFiles}"
       includes="${compile.includedFiles}"
       extdirs="${compile.extdirs}"
       fork="${compile.fork}"
       memoryMaximumSize="${compile.memoryMaximumSize}"
       includeAntRuntime="false">
       <classpath>
         <filelist dir="${compile.library.dir}" 
files="${compile.library.classpath}"/>
       </classpath>
     </javac>
   </target>

Scott


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message