Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Prevent Reduntant compilation IN ANT

 
maha laxmi
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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" />
</path>

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

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


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

</project>
 
Dave Tuttle
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this: http://ant.apache.org/faq.html#always-recompiles
--Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic