You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Rosemarie Hannan (Financial IQ)" <Ro...@fin-soft.co.za> on 2002/01/30 10:44:33 UTC
Multiple classes to one jar file
Hi
I would like to know if it possible to compile multiple class files and then
package them into one jar file via one build file?
Thanks
Rose
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Multiple classes to one jar file
Posted by Tim O'Brien <to...@discursive.com>.
Rosemarie,
The answer to the question is yes. Please post questions about the usage of
ant to the Ant User's mailing list only.
If you look at the example build.xml file in the documentation
http://jakarta.apache.org/ant/manual/index.html. Navigate to "Using Ant",
and you will see the following example. Note that the "compile" and "dist"
targets do exactly what you asking about.
The example is "postfixed" to this response.
<project name="MyProject" default="dist" basedir=".">
<!-- set global properties for this build -->
<property name="src" value="."/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<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}"/>
</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>
-----Original Message-----
From: Rosemarie Hannan (Financial IQ) [mailto:RosemarieH@fin-soft.co.za]
Sent: Wednesday, January 30, 2002 3:45 AM
To: dev; Users
Subject: Multiple classes to one jar file
Hi
I would like to know if it possible to compile multiple class files and then
package them into one jar file via one build file?
Thanks
Rose
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>