Example Ant build script for JBuilder 7 applications

Abstract: Example Ant build script for JBuilder 7 applications

1. Copy the italicized text below and paste into a text file.

2. Save or rename the file to "build.xml"

3. Place a copy of the file into your project directory

4. In JBuilder (7), use Add Files/Packages to add the build.xml to your project

5. When the build.xml appears in the project pane, right-click on it, choose Properties and then select the Ant tab for additional options.

<project name="JBProject" default="compile" basedir=".">

<description>
Example of a basic build.xml that will work with JBuilder applications.
This file should be placed in the project directory.
In JBuilder, add this file to the current project so that it appears in the Project Pane
Once the build.xml is added to the project, right-click on it, choose Properties and then select the Ant tab for more options.
</description>

<!-- Global properties for this script -->
<property name="src" location="src"/>
<property name="classes" location="classes"/>
<property name="archive" location="archive"/>

<target name="init">
<!-- Creates a time stamp -->
<tstamp/>
<!-- Create the classes directory structure -->
<mkdir dir="${classes}"/>
</target>

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

<target name="archive" depends="compile" description="generate the archive" >
<!-- Put everything in ${classes} into a basic archive into $(archive)/lib/JBProject-${DSTAMP}.jar -->
<mkdir dir="${archive}/lib"/>
<jar jarfile="${archive}/lib/JBProject-${DSTAMP}.jar" basedir="${classes}"/>
</target>

<target name="clean" description="deletes classes and archive directories" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${classes}"/>
<delete dir="${archive}"/>
</target>

</project>