ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Wilson" <>
Subject deploy task to Tomcat partially works
Date Tue, 30 Oct 2007 21:14:56 GMT
Hi All,

I have written my first Ant script from scratch, using google and the
O'reilly definitive guide.  I'm mostly happy with what I have ended up with,
however when I try to use the Tomcat DeployTask my application is not
deployed as expected.

If I manually copy my war file to the webapps directory everything is fine,
so I really would like to understand how to use ant to deploy using the
Tomcat task (rather than copying directly to the webapp folder - it seems

The files created after running the DeployTask are...




(note none of my jsp files or images are present!)

Why did it put ciderbob-website.war INSIDE a ciderbob-website directory? Or
more to the point, why does Tomcat not expand all of the contents? If I
manually copy the war file to {webapps} it all works properly!!?!

Here is my full ant build file...

Any help would be very much appreciated.



<?xml version="1.0" encoding = "UTF-8"?>

<project name="ciderbob-common" default="build" basedir=".">

<property name="src" location="./src"/>

<property name="deploy" location="./deploy"/>

<property name="warfile" location="${deploy}/ciderbob-website.war"/>

<property name="web-lib.dir" location="./libs" />

<property name="common-lib" location="../common/bin/lib"/>

<property name="webcontent.dir" location="./WebContent"/>

<property name="web-inf.dir" location="${webcontent.dir}/WEB-INF"/>

<property name="meta-inf.dir" location="${webcontent.dir}/META-INF"/>

<property name="local.manager.url" value="http://localhost:8080/manager"/>

<property name="local.manager.username" value="admin"/>

<property name="local.manager.password" value="yeaRight!"/>

<property name="local.deploy.path" value="/ciderbob-website"/>

<property name="local.war" value="file://${deploy}/"/>

<target name="deploy-local" depends="build">


You must copy the server/lib/catalina-ant.jar from Tomcat 5

directory into the lib directory of your Ant installation to

use these tasks. (also had to add to eclipse ant path!?)

Also requires manager privileges with Tomcat - edit

conf/tomcat-users.xml to add manager privileges for a username

and password.


<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/>

<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/>

<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/>

<undeploy url="${local.manager.url}"



path="${local.deploy.path}" failonerror="no"/>

<!-- this results in the following files being created




Why did it put ciderbob-website.war INSIDE a ciderbob-website

directory? Or more to the point, why does Tomcat not expand all of

the contents? If I manually copy the war file to {webapps} it all

works properly!!?!


<deploy url="${local.manager.url}"







<reload url="${local.manager.url}"





<target name="build" depends="Initialize, Compile, War">

<echo message="Building..."/>


<target name="Initialize">

<echo message="Initialising..."/>

<delete dir="${deploy}"/>

<mkdir dir="${deploy}"/>


<path id="classpath">

<fileset dir="${common-lib}">

<include name="**/*.jar"/>


<fileset dir="${web-lib.dir}">

<include name="**/*.jar"/>



<echo message="Classpath... ${classpath}"/>

<target name="Compile" depends="Initialize">

<depend srcDir="${common-lib}">


<echo message="Compiling..."/>

<javac srcdir="${src}" destdir="${deploy}" includes="**/*.java"

<classpath refid="classpath"/>



<target name="War" depends="Initialize, Compile">

<echo message="Generating War file..."/>

<war destfile="${warfile}" webxml="${web-inf.dir}/web.xml">

<classes dir="${src}" includes="**/*.xml" />

<classes dir="${deploy}" includes="**/*.class" />

<fileset dir="${webcontent.dir}">

<include name="**/*"/>


<lib dir="${web-lib.dir}" includes="**/*.jar" />

<lib dir="${common-lib}" includes="**/*.jar" />




  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message