Chapter 6 Development Processes

The following details a fairly generic process for creating web applications using Tomcat.

One-time Setup of Ant and Tomcat for Development

To use the special Ant tasks that interact with the Manager web application, perform the following tasks:

  • Configure the Ant custom tasks. Copy $CATALINA_HOME/server/lib/catalina-ant.jar onto the lib directory of your Ant installation.
  • Define one or more Tomcat users. For security purposes, the Manager web application requires a user to be logged in, and have the security role manager assigned to him or her. You may define users using Tomcat’s conf/server.xml file. You may also define any number of users with the manager role.

Create Project Source Code Directory

Follow these steps to create a new project source directory:

1. Create a project source directory and define it within the CVS repository.

2. Verify if the source directory was correctly created in CVS.

3. Create and check in an initial version of the build.xml script to be used for development.

4. Base the build.xml file on the basic build.xml file.

5. Customize the Ant properties that are named in the build.xml script.

6. Create the initial version of the web application deployment descriptor.

Edit Source Code and Page

To refresh the development directory, type the following:

cd {my home directory}
    cd myapp
    cvs update -dP

To commit a new file to the repository, type the following:

cd {my home directory}
    cd myapp/web
    emacs mypage.jsp
    cvs add mypage.jsp
    ... build and test the application ...
    cvs commit>

Build the web application

Type the following commands to compile the application:

cd {my home directory}
    cd myapp
    ant

Ant executes the defauly compile target in the build.xml file.

To forcibly recompile the entire application, type the following:

cd {my home directory}
    cd myapp
    ant all

Testing Web Application

Follow these steps to test the application:

1. Start Tomcat.

2. Compile the application by using ant compile command.

3. Install the application by using the ant install command.

4. Test the functionality of the application.

5. If changes are needed, modify and rebuild.

6. Use the ant reload command to reload the application.

7. After testing the application, remove the application by running the ant remove command.

Creating the Release

Once the application is ready for release, create a distributable version. Follow these steps in creating a release version:

1.Rebuild the application by using the command ant all.

2.Create an identifier for all of the source files by using the cvs tag command.

3.Create a distributable web application archive (WAR) file by using ant dist command.

4.Use tar or zip utility to package contents of the dist directory.


  • Currently 3.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
  Flag Inappropriate Content 0 comments