ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim O'Brien" <tobr...@discursive.com>
Subject RE: Multiple classes to one jar file
Date Wed, 30 Jan 2002 14:41:18 GMT
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:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>



--
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