ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sujan Digumarti <>
Subject RE: Ant start on a given file
Date Tue, 09 Apr 2002 09:48:29 GMT
You can create two targets in the build.xml file for this purpose and
call them accordingly

for ex:
$ ant <target name for building applet>
$ ant <target name for building application>

For compiling only specific files or excluding specific files
you can use the include and exclude tags with javac
Have a look at the docs for javac


-----Original Message-----
From: comp boy []
Sent: Tuesday, April 09, 2002 9:48 AM
Subject: Ant start on a given file

I have source code directory that has files to create both an applet version
and a standalone application version.  Most of the src files are needed by
both versions but some have files only necessary for one or the other.  Is
there a tag in the build.xml file where I can specify a target and it will
compile just a applet version (ant applet) or a standalone (ant standalone)
and it will start compiling at the main file for each and not compile all
the files in the src directory.  I am new to Ant and have read through much
of the documentation but haven't been able to find something taht will
satisfy my need.  I used to just run javac and the file name to do it, but I
decided to finally move into the 21st century and automate this process.


This is what I have right now:

<project name="project" default="dist" basedir=".">

<!-- set global properties for this build -->

<property name="src" value="src"/>
<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/project-${DSTAMP}.jar" basedir="${build}"/>

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


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

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

View raw message