ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim O'Brien" <>
Subject RE: Multiple classes to one jar file
Date Wed, 30 Jan 2002 14:41:18 GMT

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  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 -->
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>

  <target name="compile" depends="init">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>

  <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 name="clean">
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>

-----Original Message-----
From: Rosemarie Hannan (Financial IQ) []
Sent: Wednesday, January 30, 2002 3:45 AM
To: dev; Users
Subject: Multiple classes to one jar file


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?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message