You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael 'Mickey' Sattler <mi...@GeekTimes.com> on 2001/06/19 19:17:46 UTC

Tomcat + Ant: precompiling servlets & making a WAR file

Attached is the Ant build.xml file (very lightly edited from the 
default version). I have been reading posts in both the Tomcat-user 
and Ant-user lists, but I still don't feel that I understand what I 
need to do in order to test the most simple case of (1) using jspc to 
precompile servlets and (2) make a WAR file to drop over at the test 
machine.

Would someone please take a wee bit of pity on a guy battling a 
deadline (okay, who isn't? :-) and show me what you've done to get 
this to work.

Many, many thanks.

  == snip ==

<project name="Test Project" default="compile" basedir=".">

   <property name="app.name"       value="testproject"/>
   <property name="tomcat.home" 
value="/Users/mickey/Applications/java/jakarta/tomcat-3.2.1"/>
   <property name="deploy.home"    value="${tomcat.home}/webapps/${app.name}"/>
   <property name="dist.home"      value="${deploy.home}"/>
   <property name="dist.src"       value="${app.name}.jar"/>
   <property name="dist.war"       value="${app.name}.war"/>
   <property name="javadoc.home"   value="${deploy.home}/javadoc"/>


   <target	name="clean">
     <delete	dir="${deploy.home}"/>
   </target>


   <target name="prepare">
     <mkdir  dir="${deploy.home}"/>
     <copy	todir="${deploy.home}">
       <fileset dir="web"/>
     </copy>
     <mkdir	dir="${deploy.home}/WEB-INF"/>
     <copy	file="etc/web.xml" tofile="${deploy.home}/WEB-INF/web.xml"/>
     <mkdir  dir="${deploy.home}/WEB-INF/classes"/>
     <mkdir  dir="${javadoc.home}"/>
	<!-- For Ora taglib (from JavaServer Pages book) -->
     <mkdir	dir="${deploy.home}/WEB-INF/tlds"/>
     <copy	todir="${deploy.home}/WEB-INF/lib"><fileset 
dir="etc/lib"/></copy>
     <copy	todir="${deploy.home}/WEB-INF/tlds"><fileset 
dir="etc/tlds"/></copy>
   </target>


   <target name="compile" depends="prepare">
     <javac	srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
			classpath="${deploy.home}/WEB-INF/classes"
			debug="on" optimize="off" deprecation="off"/>
     <copy	todir="${deploy.home}/WEB-INF/classes">
       <fileset dir="src" includes="**/*.properties"/>
     </copy>
   </target>


   <target name="javadoc" depends="prepare">
     <javadoc sourcepath="src" packagenames="*"
                 destdir="${javadoc.home}"/>
   </target>


   <target name="all" depends="clean,prepare,compile,javadoc"/>


   <target name="dist" depends="prepare,compile">
     <jar jarfile="${dist.home}/${dist.src}"
          basedir="." includes="*"/>
     <jar jarfile="${dist.home}/${dist.war}"
          basedir="${deploy.home}" includes="*"/>
   </target>

</project>
-- 
Michael "Mickey" Sattler, Geek Times   <ma...@REMOVE-GeekTimes.com>
San Francisco, California, USA    <http://www.GeekTimes.com/michael/>

I was born not knowing and have had only a little time to change that here
and there. -- Richard Feynman (1918 - 1988)