Thursday, November 04, 2010

Tomcat deploy arbitrary dir

To deploy a webapp from a directory not in the appBase (the webapps directory by default) of Tomcat /Catalina, then its simple.

At its most simple you simply create a file in the $CATALINA_BASE/conf/[enginename]/[hostname] directory.

The name of the file is the webapp Context name you want.

The contents must include the docBase attribute. This points the location of the webapp.

This is very useful for development, so every change can be immediately realised on the webapp without restarting, or undeploying/ deploying (which is necessary if you deploy it using Tomcats manager, since it copies the apps into the webapp directory.)

e.g. save SpringSchedule.xml in the $CATALINA_BASE/conf/[enginename]/[hostname]


<Context docBase="F:/eclipse_workspace/SpringSchedule/www">

</Context>

Note: If you add properties files, or update the web.xml you will need to reload the webapp from the tomcat manager console.

Ref

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

No comments: