File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes How to Prevent Reduntant compilation IN ANT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to Prevent Reduntant compilation IN ANT " Watch "How to Prevent Reduntant compilation IN ANT " New topic

How to Prevent Reduntant compilation IN ANT

maha laxmi
Ranch Hand

Joined: Sep 23, 2005
Posts: 68
see this build.xml

init is separate task,compilation is separate task here;when i run this script for the firsttime it compiled the files;but next time i didnt change anything in source files;i dont want to source files to be compiled again;will ant script run the compile task(compile the all source files) again?

<project name="MyProject" default="dist" basedir=".">
<description>simple example build file</description>
<!-- set global properties for this build -->
<property name="src" location="com/blah/blah/blah"/>
<property name="build" value="c:/JDeveloper/jdev/mywork/Model/classes"/>
<property name="ejbjardir" value="C:/Source/dist"/>
<property name="CopyofEjbJAR" value="c:/downloads"/>
<property name="jdev.home" value="C:/JDeveloper"/>

<path id="common.class.path">
<pathelement location="${jdev.home}/j2ee/home/lib/ejb.jar" />
<pathelement location="c:/utilities/commons-logging.jar" />

<property name="common.class.path" refid="common.class.path"/>

<target name="init">
<delete file="${CopyofEjbJAR}/EJB.jar"/>
<copy file="${ejbjardir}/EJB.jar" todir="${CopyofEjbJAR}"/>
<fileset dir="." includes="**/*.cdi"/>

<target name="compile" depends="init" description="compile the source ">
<javac srcdir="${src}" destdir="${build}" debug="on">
<pathelement path="${common.class.path}" />

Dave Tuttle
Ranch Hand

Joined: Jan 18, 2006
Posts: 34
Try this:
I agree. Here's the link:
subject: How to Prevent Reduntant compilation IN ANT
It's not a secret anymore!