ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mani G. Iyer" <>
Subject RE: Tomcat startup/shutdown
Date Fri, 11 Jun 2004 01:27:51 GMT

Tomcat has provided tasks to accomplish a lot of management tasks.  
Check the Tomcat documentation and look for the section "Executing
Management commands with Ant".   I am reproducing relevant portions of
it here:
In addition to the ability to execute Manager commands via HTTP
requests, as documented above, Tomcat 4 includes a convenient set of
Task definitions for the Ant (version 1.4 or later) build tool. In order
to use these commands, you must perform the following setup operations:

- Copy the file server/lib/catalina-ant.jar from your Tomcat 4
installation into Ant's library directory ($ANT_HOME/lib). 
- Configure at least one username/password combination in your Tomcat
user database that includes the manager role. 
- To use custom tasks within Ant, you must declare them first with a
<taskdef> element. Therefore, your build.xml file might look something
like this:

<project name="My Application" default="compile" basedir=".">

  <!-- Configure the directory into which the web application is built
  <property name="build"    value="${basedir}/build"/>

  <!-- Configure the context path for this application -->
  <property name="path"     value="/myapp"/>

  <!-- Configure properties to access the Manager application -->
  <property name="url"      value="http://localhost:8080/manager"/>
  <property name="username" value="myusername"/>
  <property name="password" value="mypassword"/>

  <!-- Configure the custom Ant tasks for the Manager application -->
  <taskdef name="deploy"
  <taskdef name="install"
  <taskdef name="list"
  <taskdef name="reload"
  <taskdef name="remove"
  <taskdef name="resources"
  <taskdef name="roles"
  <taskdef name="start"
  <taskdef name="stop"
  <taskdef name="undeploy"

  <!-- Executable Targets -->
  <target name="compile" description="Compile web application">
    <!-- ... construct web application in ${build} subdirectory ... -->

  <target name="install" description="Install web application"
    <install url="${url}" username="${username}" password="${password}"
            path="${path}" war="file://${build}"/>

  <target name="reload" description="Reload web application"
    <reload  url="${url}" username="${username}" password="${password}"

  <target name="remove" description="Remove web application">
    <remove url="${url}" username="${username}" password="${password}"



-----Original Message-----
From: William BC Crandall [] 
Sent: Thursday, June 10, 2004 8:50 PM
To: Ant Users List
Subject: Tomcat startup/shutdown

Greetings, fellow Antophiles,

Eric Burke and Brian Coyner state that "As of [March 2003]
there is no generic way to [start and stop Tomcat from Ant]."

They then offer some classes to do just that. (In _Java
Extreme Programming Cookbook_, p. 245, with code samples
available at

In the last year and a half, has anyone devised an Ant task
for this? Or is their code the best place to start? 

Thanks to all for any pointers.

Best wishes,

William BC Crandall
bc.crandall [around]

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message