From da476129108f02048b9d5312225c4cbc7bc6323d Mon Sep 17 00:00:00 2001
From: timw
-Building Apache Tomcat from SVN is very easy, and is the first step to contributing to
-Tomcat. The following is a step by step TODO list.
+Building Apache Tomcat from source is very easy, and is the first step to contributing to
+Tomcat. The following is a step by step guide.
-The Sun JDK can be downloaded
+Tomcat requires a JDK (version 1.6 or later) to be installed.
+
Unpack the binary distribution into a convenient location so that the
Ant release resides in its own directory (conventionally named
-"apache-ant-1.8.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},
+IMPORTANT: Create an ANT_HOME environment variable to point the directory
- Tomcat SVN repository URL:
-
- Download a source package from:
-
- Checkout the source using SVN, selecting the desired version or
- branch (current development source is at
-
-Use the following commands:
+Use the following commands to build Tomcat:
+
-NOTE: Users accessing the Internet through a proxy must use a properties
- file to indicate to Ant the proxy configuration. Read below.
+NOTE: Users accessing the Internet through a proxy must use a properties
+ file to indicate to Ant the proxy configuration. Read below for details.
-WARNING: Running this command will download binaries to the
-
-The build can be controlled by creating a ${tomcat.source}/build.properties
- file, and adding the following content to it:
+ The build can be controlled by creating a
+Once the build has completed successfully, a usable Tomcat installation will have been
+produced in the
-Important:
-This is not a supported means of building Tomcat; this information is
+IMPORTANT: This is not a supported means of building Tomcat; this information is
provided without warranty :-).
-The only supported means of building Tomcat is with the "ant build"
-described above.
+The only supported means of building Tomcat 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;
+NOTE: You must complete all the above steps to fetch
+dependency libraries and build Tomcat before you can setup an Eclipse project and start
+using it.
+
+NOTE: 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.
+Complete the download of all third party dependencies required to compile the Tomcat
+source in Eclipse:
+
+Sample Eclipse project and classpath files are provided in the root directory of the source tree.
+The sample files are named
-Use Windows->Preferences and then Java->Build Path->Classpath
-Variables to add two new Classpath variables:
+Start Eclipse and create a new Workspace.
-
The Sun JDK can be downloaded
here.
apache-ant-1.8.x). For the remainder of this guide,
+the symbolic name ${ant.home} is used to refer to the full pathname of
+ the Ant installation directory 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
+${ant.home}/bin in its list. This makes the ant command line script
available, which will be used to actually perform the build.
http://svn.apache.org/repos/asf/tomcat/tc7.0.x/
+ Tomcat SVN repository URL:
+ http://svn.apache.org/repos/asf/tomcat/trunk/
http://tomcat.apache.org/download-70.cgi
+ Tomcat source packages:
+ http://tomcat.apache.org/download-70.cgi.
http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/), or
- unpack the source package. The location where the source has been
- placed will be referred as ${tomcat.source}.
+ Checkout the source using SVN, or download and unpack a source package.
+ For the remainder of this guide, the symbolic name ${tomcat.source} is used to refer to the
+ location where the source has been placed.
cd ${tomcat.source}
ant
@@ -113,13 +112,13 @@ Use the following commands:
/usr/share/java directory.
+WARNING: Running this command will download binary binaries to the
+ /usr/share/java directory by default.
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
@@ -127,8 +126,9 @@ WARNING: Running this command will download binaries to the
${tomcat.source}/build.properties
+ file and adding the following content to it:
+
# ----- Proxy setup -----
# Uncomment if using a proxy server.
@@ -143,84 +143,96 @@ The build can be controlled by creating a ${tomcat.source}/build.properties
${tomcat.source}/output/build directory, and can be started
+and stopped with the usual scripts.
+
+
+
+ cd ${tomcat.source}
+ ant extras
+eclipse.project and eclipse.classpath, and must
+be copied to .project and .classpath respectively before proceeding.
+
-
+Open the Preferences dialog and then select Java->Build Path->Classpath
+Variables to add two new Classpath Variables:
- TOMCAT_LIBS_BASE the base path where the binary dependencies have been downloaded
-ANT_HOME the base path of Ant 1.8.1 or later
-Use File->Import and chose "Existing Projects into Workspace". -From there import the root directory where you have checked out tomcat. +
| TOMCAT_LIBS_BASE | The same location as the base.path
+ setting in build.properties, where the binary dependencies have been downloaded |
| ANT_HOME | the base path of Ant 1.8.1 or later |
-Eclipse .project and .classpath files are provided in to root directory of tomcat repository
-should allow Eclipse to find all source trees and jars, and
-hopefully compile without problems. Note that these
-files assume you are using Eclipse with a 6.0 or later JDK.
+Use File->Import and choose Existing Projects into Workspace.
+From there choose the root directory of the Tomcat source tree (${tomcat.source})
+and import the Tomcat project located there.
-To run Tomcat 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.
+You may see errors in your problems tab at this point about missing build path dependencies.
+If this happens you have forgotten to execute the ant extras build to download
+these dependencies.
-Note also that due to the way the Tomcat source is assembled
-from several SVN projects, you may not be able to use the Eclipse
-SVN client to update (nor to commit, if you are a committer).
-Use the external SVN client of your choice, then use the
-Eclipse PackageExplorer or Navigator "Refresh" context menu item
-to tell Eclipse that you've updated the files.
+Start Tomcat and Stop Tomcat launch configurations are provided in the
+root directory of the source tree and will be available in the Run->Run Configurations
+dialog. Use these to start and stop Tomcat from Eclipse.
+
If you want to configure these yourself (or are using a different IDE)
+then use org.apache.catalina.startup.Catalina as the main class,
+start/stop as program arguments, and specify -Dcatalina.home=...
+(with the name of your build directory) as VM arguments.
-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. +The same general approach should work for most IDEs; it has been reported +to work in IntelliJ IDEA, for example.