When trying to build my project with ant my servlets are not compiled and
are not copied to WEB-INF/classes in my project directory. All other files
(eg support files) in my src directory are being copied no problem.
When I execute javac from the command line the servlets compile fine so I
believe I have set up the environment variables correctly.
I've installed jdk1.3, tomcat 3.1 and ant 1.2 on Win2K Prof
Here is a copy of my build.bat and build.xml file
Thanks in advance for your help.
Max
@echo off
rem build.bat -- Build Script for the "myApp" Application
rem $Id: build.bat,v 1.1 2000/04/04 22:01:13 craigmcc Exp $
if "%CLASSPATH%" == "" goto noclasspath
:haveclasspath
set _CLASSPATH=%CLASSPATH%
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME\classes
goto restofclasspath
:noclasspath
set _CLASSPATH=
set CLASSPATH=%TOMCAT_HOME%\classes
:restofclasspath
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\ant.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
rem set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
set CLASSPATH=%CLASSPATH%;C:\Programme\Jaxp1.0.1\jaxp.jar
set CLASSPATH=%CLASSPATH%;C:\Programme\Jaxp1.0.1\parser.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
rem Execute ANT to perform the requested build target
rem This is what I had
rem java -Dtomcat.home=%TOMCAT_HOME% org.apache.tools.ant.Main %1 %2 %3 %4
%5 %6 %7 %8 %9
rem This is from the sample build file
java org.apache.tools.ant.Main -Dtomcat.home=%TOMCAT_HOME% %1 %2 %3 %4 %5 %6
%7 %8 %9
set CLASSPATH=%_CLASSPATH%
set _CLASSPATH=
******************************
<project name="myApp" default="compile" basedir=".">
<!-- Simple "Hello, World" project to provide a concrete example of
the recommendations in the Application Developer's Guide.
NOTE: Before using this file as is, you should review the
values for the properties that are defined below.
In particular, it is assumed that you wish to install this
application under context path "/myapp" in the Tomcat installation
defined by your TOMCAT_HOME environment variable.
-->
<property name="app.name" value="myApp"/>
<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="prepare" init="init">
<mkdir dir="${deploy.home}"/>
<copydir src="web" dest="${deploy.home}"/>
<mkdir dir="${deploy.home}/WEB-INF"/>
<copyfile src="etc/web.xml" dest="${deploy.home}/WEB-INF/web.xml"/>
<mkdir dir="${deploy.home}/WEB-INF/classes"/>
<mkdir dir="${deploy.home}/WEB-INF/lib"/>
<copydir src="lib" dest="${deploy.home}/lib"/>
<mkdir dir="${javadoc.home}"/>
</target>
<target name="clean" init="init">
<deltree dir="${deploy.home}"/>
</target>
<target name="compile" depends="prepare" init="init">
<javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
classpath="${deploy.home}/WEB-INF/classes" debug="on" optimize="off"
deprecation="off"/>
</target>
<target name="javadoc" depends="prepare" init="init">
<!-- TODO -->
</target>
<target name="all" depends="clean,prepare,compile,javadoc" init="init"/>
<target name="dist" depends="prepare,compile" init="init">
<jar jarfile="${dist.home}/${dist.src}" basedir="." items="*"/>
<jar jarfile="${dist.home}/${dist.war}" basedir="${deploy.home}"
items="*"/>
</target>
</project>