From da476129108f02048b9d5312225c4cbc7bc6323d Mon Sep 17 00:00:00 2001 From: timw Date: Thu, 23 Sep 2010 10:15:16 +0000 Subject: [PATCH] https://issues.apache.org/bugzilla/show_bug.cgi?id=49955 Improvements and corrections for the Building Tomcat guide, plus sample Eclipse launch targets. Based on contribution from Wesley Acheson. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1000392 13f79535-47bb-0310-9956-ffa450edef68 --- Start Tomcat.launch | 13 ++++ Stop Tomcat.launch | 13 ++++ webapps/docs/building.xml | 146 ++++++++++++++++++++++++--------------------- webapps/docs/changelog.xml | 5 ++ 4 files changed, 110 insertions(+), 67 deletions(-) create mode 100644 Start Tomcat.launch create mode 100644 Stop Tomcat.launch diff --git a/Start Tomcat.launch b/Start Tomcat.launch new file mode 100644 index 000000000..4f4f1eb92 --- /dev/null +++ b/Start Tomcat.launch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Stop Tomcat.launch b/Stop Tomcat.launch new file mode 100644 index 000000000..21c00f47b --- /dev/null +++ b/Stop Tomcat.launch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/webapps/docs/building.xml b/webapps/docs/building.xml index a365047db..53ec5e2fe 100644 --- a/webapps/docs/building.xml +++ b/webapps/docs/building.xml @@ -23,7 +23,7 @@ &project; - Remy Maucherat + Remy Maucherat, Tim Whittington Building Tomcat @@ -36,16 +36,17 @@

-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. +
The Sun JDK can be downloaded here.

@@ -66,15 +67,15 @@ Download a binary distribution of Ant 1.8.1 or later from

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. +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.

-Create an ANT_HOME environment variable to point the directory ${ant.home}, +IMPORTANT: 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 +${ant.home}/bin in its list. This makes the ant command line script available, which will be used to actually perform the build.

@@ -83,29 +84,27 @@ available, which will be used to actually perform the build.

- Tomcat SVN repository URL: - http://svn.apache.org/repos/asf/tomcat/tc7.0.x/ + Tomcat SVN repository URL: + http://svn.apache.org/repos/asf/tomcat/trunk/

-

- Download a source package from: - http://tomcat.apache.org/download-70.cgi + Tomcat source packages: + http://tomcat.apache.org/download-70.cgi.

- +

- Checkout the source using SVN, selecting the desired version or - branch (current development source is at - 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.

- +

-Use the following commands: +Use the following commands to build Tomcat: +

cd ${tomcat.source}
ant
@@ -113,13 +112,13 @@ Use the following commands:

-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 - /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

-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 ${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

+

+Once the build has completed successfully, a usable Tomcat installation will have been +produced in the ${tomcat.source}/output/build directory, and can be started +and stopped with the usual scripts. +

-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: +
+
+ cd ${tomcat.source}
+ ant extras
+
+

+

+Sample Eclipse project and classpath files are provided in the root directory of the source tree. +The sample files are named eclipse.project and eclipse.classpath, and must +be copied to .project and .classpath respectively before proceeding. +

-Use Windows->Preferences and then Java->Build Path->Classpath -Variables to add two new Classpath variables: +Start Eclipse and create a new Workspace.

- - - -
TOMCAT_LIBS_BASEthe base path where the binary dependencies have been downloaded
ANT_HOMEthe base path of Ant 1.8.1 or later
+Open the Preferences dialog and then select Java->Build Path->Classpath +Variables to add two new Classpath Variables:

-Use File->Import and chose "Existing Projects into Workspace". -From there import the root directory where you have checked out tomcat. + + + +
TOMCAT_LIBS_BASEThe same location as the base.path + setting in build.properties, where the binary dependencies have been downloaded
ANT_HOMEthe 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.

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index b4cf184d6..eab9ed7ba 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -30,6 +30,7 @@ Konstantin Kolinko Peter Rossbach Keiichi Fujino + Tim Whittington Changelog @@ -261,6 +262,10 @@ Update commons pool to 1.5.5. (markt) + + 49955: Improvement and correction of Building Tomcat guide. + Based on a patch from Wesley Acheson. (timw) +
-- 2.11.0