You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Kevin C. Dorff" <kc...@med.cornell.edu> on 2005/11/10 19:39:26 UTC

Ant Deploy to a Subdirectory of appBase

I have my application running as is my Ant script that I use to deploy,
undeploy, redploy to the running server. That is working like a charm when
my deploy path is to the appbase, such as

My context.xml file

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="twease.war" antiResourceLocking="true"
antiJARLocking="true">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

Portion of my ant script

<target name="deploy" description="Install application in Tomcat"
depends="war">
<deploy url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="/myapp"
war="file:${basedir}/${webapp.war}"/>
</target>

This uploads the war file to the server to the "webapps" directory
(appBase). The war file unzips, the META-INF/context.xml is copied to
conf/Catalina/localhost, the application is started, the deploy task passes.
All is happy.

BUT, what we want is to deploy into a subdirectory of appBase named apps (so
deploy path this app to "webapps/apps") so we use

<target name="deploy" description="Install application in Tomcat"
depends="war">
<deploy url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="/apps/myapp"
war="file:${basedir}/${webapp.war}"/>
</target>

This uploads the war file into "webapps/apps" but never unzips the war file,
never copies the context file, deploy task fails. If I manually unzip the
war and manually copy the context file to the conf/Catalina/localhost
directory as #apps#myapp.xml the application works (and can be undeployed
using ant) but I really want to be able to use the ant deploy task to
install the app. We previously saw Tomcat would look within directories for
war files and handle them, now it seems it won't.

Can anyone point me in the right direction on this? Reading the
documentation for deployment, Host, etc. it suggests tomcat will only maybe
install wars from the appBase directory ("webapps"), but, I know we have
seen it deploy wars from subdirectories before.

Any help greatly appreciated.
Kevin