ant-user mailing list archives

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

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"
classname="org.apache.catalina.ant.DeployTask"/>
  <taskdef name="install"
classname="org.apache.catalina.ant.InstallTask"/>
  <taskdef name="list"
classname="org.apache.catalina.ant.ListTask"/>
  <taskdef name="reload"
classname="org.apache.catalina.ant.ReloadTask"/>
  <taskdef name="remove"
classname="org.apache.catalina.ant.RemoveTask"/>
  <taskdef name="resources"
classname="org.apache.catalina.ant.ResourcesTask"/>
  <taskdef name="roles"
classname="org.apache.catalina.ant.RolesTask"/>
  <taskdef name="start"
classname="org.apache.catalina.ant.StartTask"/>
  <taskdef name="stop"
classname="org.apache.catalina.ant.StopTask"/>
  <taskdef name="undeploy"
classname="org.apache.catalina.ant.UndeployTask"/>

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

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

  <target name="reload" description="Reload web application"
          depends="compile">
    <reload  url="${url}" username="${username}" password="${password}"
            path="${path}"/>
  </target>

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

</project>

HTH
Mani

-----Original Message-----
From: William BC Crandall [mailto:bc.crandall@earthlink.net] 
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 http://examples.oreilly.com/jextprockbk/

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] earthlink.net




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message