JBoss, a division of Red HatJBoss.org - Community driven.
Printer Friendly Version

Building Tomcat


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

Download a Java Development Kit (JDK) release (version 1.5.x or later)

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.6.5 or later

Download a binary distribution of Ant 1.6.5 or later from here.

Unpack the binary distribution into a convenient location so that the Ant release resides in its own directory (conventionally named "apache-ant-1.6.x"). 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.

Checkout or obtain the source code for JBoss Web

JBoss Web SVN repository URL: http://svn.jboss.org/repos/jbossweb/trunk

Download a source package from: http://labs.jboss.com/jbossweb/

Checkout the source using SVN, selecting the desired version or branch (current development source is at http://svn.jboss.org/repos/jbossweb/trunk), or unpack the source package. The location where the source has been placed will be referred as ${jbossweb.source}.

Building JBoss Web

Use the following commands:
cd ${jbossweb.source}
ant download

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 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 ${jbossweb.source}/build.properties file, and adding the following content to it:

# ----- Proxy setup -----
# Uncomment if using a proxy server.

# ----- Default Base Path for Dependent Packages -----
# Replace this path with the directory path where
# dependencies binaries should be downloaded.

Building with Eclipse

Important: This is not a supported means of building JBoss Web; this information is provided without warranty :-). The only supported means of building JBoss Web is with the "ant build" described above. However, some developers like to work on Java code with a Java IDE, and the following steps have been used by some developers.

Note that you must complete all the above steps to fetch the repositories and build some JAR files the first time. After you have completed the above steps, you can set up a series of Eclipse 4 projects. Note that this will not let you build everything under Eclipse; the build process requires use of Ant for the many stages that aren't simple Java compilations. However, it will allow you to view and edit the Java code, get warnings, reformat code, perform refactorings, run Tomcat under the IDE, and so on.

Use Windows->Preferences and then Java->Build Path->Classpath Variables to add two new Classpath variables:


The base path where the binary dependencies have been downloaded.


The base path of Ant 1.6.5 or later.

Use File->New Project to create a new Java project for each of the binaries repository (e.g., /usr/share/java), container, connectors, jasper, servletapi. Unless you thought ahead to make the ${jbossweb.source} directory be under your Workspace folder, tell Eclipse the external location using "Import/Export...", General->Existing Project into Workspace.

Eclipse .project and .classpath files are provided in each of these directories so Eclipse should find all source trees and jars, and hopefully compile without problems. Note that these files assume you are using Eclipse with a 5.0 or later JDK; also, the connectors module must be built with a compiler compliance level of 5.0.

To run JBoss Web without a special IDE plug-in, you can simply use Run->Run... enter "org.apache.catalina.startup.Catalina" as the main class, "start" as program arguments, and "-Dcatalina.home=..." (with the name of your build directory) as VM arguments.

Building with other IDEs

The same caveats apply as for Eclipse, above.

The same general idea should work in most IDEs; it has been reported to work in Idea, for example.