Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Main




JSPWiki v2.2.33

[RSS]


Hide Menu

TomcatAntTasks


This is version 3. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]


I've been told I should use Tomcat's Ant Tasks (install, list, refresh, remove) in AppFuse to ease deployment of the app. So I tried that today (June 24, 2003). Here's how I set it up and what I found. I hope to use this page to get a consensus on how these tasks should be used.

1. First, I defined a tomcat.classpath for the catalina-ant.jar file. Putting in in $ANT_HOME/lib did not work - and this way seemed cleaner. So in properties.xml, I added:

    <!-- For Tomcat Tasks -->
    <path id="tomcat.classpath">
        <fileset dir="${tomcat.home}/server/lib" 
            includes="catalina-ant.jar" />
    </path>
2. Then in build.xml, I define the tasks in the "define-tasks" target:
    <!-- Tomcat Tasks -->
    <taskdef name="install" 
        classname="org.apache.catalina.ant.InstallTask" 
        classpathref="tomcat.classpath" /> 
    <taskdef name="list" 
        classname="org.apache.catalina.ant.ListTask" 
        classpathref="tomcat.classpath" /> 
    <taskdef name="reload" 
        classname="org.apache.catalina.ant.ReloadTask"
        classpathref="tomcat.classpath" /> 
    <taskdef name="remove" 
        classname="org.apache.catalina.ant.RemoveTask" 
        classpathref="tomcat.classpath" /> 
3. Then I created targets for each one of these tasks:
    <!-- =================================================================== -->
    <!-- install, list, reload and remove are all Tomcat deployment targets. -->
    <!-- =================================================================== -->
    <target name="install" depends="package-web"
        description="Install application to servlet container">
        <install url="${tomcat.manager.url}" username="${tomcat.username}"
            password="${tomcat.password}" path="/${webapp.name}"
            war="file://${webapp.dist}/${webapp.war}"/>
    </target>

    <target name="list" depends="define-tasks"
        description="List installed applications on servlet container">
        <list url="${tomcat.manager.url}" username="${tomcat.username}"
            password="${tomcat.password}" />
    </target>

    <target name="refresh" depends="package-web"
        description="Reload application on servlet container">
        <reload url="${tomcat.manager.url}" username="${tomcat.username}"
            password="${tomcat.password}" path="/${webapp.name}"/>
    </target>

    <target name="remove" depends="define-tasks"
        description="Remove application on servlet container">
        <remove url="${tomcat.manager.url}" username="${tomcat.username}"
            password="${tomcat.password}" path="/${webapp.name}"/>
    </target>
NOTE: I used "refresh" as a target name since I already have a "reload" task that stops tomcat, undeploys, cleans and redeploys.

4. My understanding is that I should be able to point the install and refresh tasks at the .war file for my app, and it'll install/reload as requested. The list and remove tasks work fine at this point.


My Issues:


Attachments:


Go to top   More info...   Attach file...
This particular version was published on 06-Nov-2006 13:52:38 MST by MattRaible.