Development Processes

Table of Contents

Development Processes

Although application development can take many forms, this manual proposes a fairly generic process for creating web applications using Tomcat. The following sections highlight the commands and tasks that you, as the developer of the code, will perform. The same basic approach works when you have multiple programmers involved, as long as you have an appropriate source code control system and internal team rules about who is working on what parts of the application at any given time.

The task descriptions below assume that you will be using CVS for source code control, and that you have already configured access to the appropriate CVS repository. Instructions for doing this are beyond the scope of this manual. If you are using a different source code control environment, you will need to figure out the corresponding commands for your system.

One-Time Setup of Ant and Tomcat for Development

In order to take advantage of the special Ant tasks that interact with the Manager web application, you need to perform the following tasks once (no matter how many web applications you plan to develop).

  • Configure the Ant custom tasks. The implementation code for the Ant custom tasks is in a JAR file named $CATALINA_HOME/lib/catalina-ant.jar, which must be copied in to the lib directory of your Ant installation.

  • Define one or more Tomcat users. The Manager web application runs under a security constraint that requires a user to be logged in, and have the security role manager-script assigned to him or her. How such users are defined depends on which Realm you have configured in Tomcat's conf/server.xml file -- see the Realm Configuration HOW-TO for more information. You may define any number of users (with any username and password that you like) with the manager-script role.

Create Project Source Code Directory

The first step is to create a new project source directory, and customize the build.xml and files you will be using. The directory structure is described in the previous section, or you can use the sample application as a starting point.

Create your project source directory, and define it within your CVS repository. This might be done by a series of commands like this, where {project} is the name under which your project should be stored in the CVS repository, and {username} is your login username:

cd {my home directory}
mkdir myapp <-- Assumed "project source directory"
cd myapp
mkdir docs
mkdir src
mkdir web
mkdir web/WEB-INF
cvs import -m "Initial Project Creation" {project} \
    {username} start

Now, to verify that it was created correctly in CVS, we will perform a checkout of the new project:

cd ..
mv myapp myapp.bu
cvs checkout {project}

Next, you will need to create and check in an initial version of the build.xml script to be used for development. For getting started quickly and easily, base your build.xml on the basic build.xml file, included with this manual, or code it from scratch.

cd {my home directory}
cd myapp
emacs build.xml     <-- if you want a real editor :-)
cvs add build.xml
cvs commit

Until you perform the CVS commit, your changes are local to your own development directory. Committing makes those changes visible to other developers on your team that are sharing the same CVS repository.

The next step is to customize the Ant properties that are named in the build.xml script. This is done by creating a file named in your project's top-level directory. The supported properties are listed in the comments inside the sample build.xml script. At a minimum, you will generally need to define the