The Jakarta Project
      The Tomcat Servlet/JSP Container

Links

User Guide

Reference

Tomcat Development

The Tomcat 5 Servlet/JSP Container

Building Tomcat

Printer Friendly Version
print-friendly
version
Introduction

Building Tomcat from CVS is very easy, and is the first step to contributing to Tomcat. The following is a step by step TODO list.

Download and install a Java Development Kit 1.4.x or later

Earlier releases would also work, but are harder to work with due to the need to download additional dependencies. Tomcat also runs much faster on the latest 1.4 JDK.

The Sun JDK can be downloaded here.

IMPORTANT: Set an environment variable JAVA_HOME to the pathname of the directory into which you installed the JDK release.

Install Apache Ant 1.5.x

Download a binary distribution of Ant 1.5.x from here.

Unpack the binary distribution into a convenient location so that the Ant release resides in its own directory (conventionally named "jakarta-ant-1.5.1"). For the purposes of the remainder of this document, the symbolic name "${ant.home}" is used to refer to the full pathname of the release directory.

Create an ANT_HOME environment variable to point the directory ${ant.home}, and modify the PATH environment variable to include directory "${ant.home}/bin" in its list. This makes the "ant" command line script available, which will be used to actually perform the build.

Building Tomcat

Download the main build.xml script from here.

Create a new directory, and copy the newly download build.xml to it. This directory will be referred to as the ${tomcat.source} directory in the rest of this document.

Go to that directory, and do:
cd ${tomcat.source}
ant

NOTE: Users accessing the Internet through a proxy must use a properties file to indicate to Ant the proxy configuration. Read below.

WARNING: Running this command will checkout the Tomcat 5 sources from CVS, as well as download binaries to the /usr/share/java directory. Make sure this is appropriate to do so on your computer. On Windows, this usually corresponds to the C:\usr\share\java directory, unless Cygwin is used. Read below to customize the directory used to download the binaries.

The build can be controlled by creating a ${tomcat.source}/build.properties file, and adding the following content to it:
# ----- Proxy setup -----
# Uncomment if using a proxy server.
#proxy.host=proxy.domain
#proxy.port=8080
#proxy.use=on

# ----- Default Base Path for Dependent Packages -----
# Replace this path with the directory path where
# dependencies binaries should be downloaded.
base.path=/usr/share/java

Updating and rebuilding Tomcat sources

It is recommended to regularly update the downloaded Tomcat 5 sources. To do this, execute the following commands:
cd ${tomcat.source}
ant checkout

For a quick rebuild of only modified code you can use:
cd ${tomcat.source}
ant build


Copyright © 1999-2003, Apache Software Foundation