Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame^] | 1 | ================================================================================
|
| 2 | Licensed to the Apache Software Foundation (ASF) under one or more
|
| 3 | contributor license agreements. See the NOTICE file distributed with
|
| 4 | this work for additional information regarding copyright ownership.
|
| 5 | The ASF licenses this file to You under the Apache License, Version 2.0
|
| 6 | (the "License"); you may not use this file except in compliance with
|
| 7 | the License. You may obtain a copy of the License at
|
| 8 |
|
| 9 | http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
|
| 11 | Unless required by applicable law or agreed to in writing, software
|
| 12 | distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 | See the License for the specific language governing permissions and
|
| 15 | limitations under the License.
|
| 16 | ================================================================================
|
| 17 |
|
| 18 | ====================================================
|
| 19 | Building The Apache Tomcat 6.0 Servlet/JSP Container
|
| 20 | ====================================================
|
| 21 |
|
| 22 | This subproject contains the source code for Tomcat 6.0, a container that
|
| 23 | implements the Servlet 2.5 and JSP 2.1 specifications from the Java
|
| 24 | Community Process <http://www.jcp.org/>.
|
| 25 |
|
| 26 | Note: If you just need to run Apache Tomcat, it is not necessary to build
|
| 27 | it. You may simply download a binary distribution. It is cross-platform.
|
| 28 | Read RUNNING.txt for the instruction on how to run it.
|
| 29 |
|
| 30 | In order to build a binary distribution version of Apache Tomcat from a
|
| 31 | source distribution, do the following:
|
| 32 |
|
| 33 |
|
| 34 | (0) Download and Install a Java Development Kit
|
| 35 |
|
| 36 | * If the JDK is already installed, skip to (1).
|
| 37 |
|
| 38 | * Download a Java Development Kit (JDK) of Java SE version 5 from
|
| 39 |
|
| 40 | http://www.oracle.com/technetwork/java/javase/downloads/index.html
|
| 41 | or from another JDK vendor.
|
| 42 |
|
| 43 | Note regarding versions of Java later than Java SE 5:
|
| 44 |
|
| 45 | As documented elsewhere, one of components in Apache Tomcat includes
|
| 46 | a private copy of the Apache Commons DBCP library. The source code
|
| 47 | for this library is downloaded, processed by the build script
|
| 48 | (renaming the packages) and compiled.
|
| 49 |
|
| 50 | Due to changes in JDBC interfaces implemented by the library between
|
| 51 | versions of Java SE specification, the library has to target specific
|
| 52 | version of Java and can be compiled only with the JDK version
|
| 53 | implementing this version of specification.
|
| 54 |
|
| 55 | See Apache Commons DBCP project web site for more details on
|
| 56 | available versions of the library and its requirements,
|
| 57 |
|
| 58 | http://commons.apache.org/dbcp/
|
| 59 |
|
| 60 | It is possible to use later versions of JDK to build Tomcat 6.0, but the
|
| 61 | building of that component (tomcat-dbcp.jar) will be skipped and a
|
| 62 | warning will be printed.
|
| 63 |
|
| 64 | * Install the JDK according to the instructions included with the release.
|
| 65 |
|
| 66 | * Set an environment variable JAVA_HOME to the pathname of the directory
|
| 67 | into which you installed the JDK release.
|
| 68 |
|
| 69 |
|
| 70 | (1) Install Apache Ant 1.6.x on your computer
|
| 71 |
|
| 72 | * If Apache Ant 1.6.x is already installed on your computer, skip to (2).
|
| 73 |
|
| 74 | * Download a binary distribution of Ant 1.6.x from:
|
| 75 |
|
| 76 | http://ant.apache.org/bindownload.cgi
|
| 77 |
|
| 78 | * Unpack the binary distribution into a convenient location so that the
|
| 79 | Ant release resides in its own directory (conventionally named
|
| 80 | "apache-ant-[version]"). For the purposes of the remainder of this document,
|
| 81 | the symbolic name "${ant.home}" is used to refer to the full pathname of
|
| 82 | the release directory.
|
| 83 |
|
| 84 | * Create an ANT_HOME environment variable to point the directory
|
| 85 | ${ant.home}.
|
| 86 |
|
| 87 | * Modify the PATH environment variable to include the directory
|
| 88 | ${ant.home}/bin in its list. This makes the "ant" command line script
|
| 89 | available, which will be used to actually perform the build.
|
| 90 |
|
| 91 |
|
| 92 | (2) Building Tomcat 6.0
|
| 93 |
|
| 94 | (2.1) Checkout or obtain the source code for Tomcat 6.0
|
| 95 |
|
| 96 | * Tomcat 6.0 SVN repository URL:
|
| 97 | http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/
|
| 98 |
|
| 99 | * Download a source package from:
|
| 100 | http://tomcat.apache.org/download-60.cgi
|
| 101 |
|
| 102 | * Checkout the source using SVN, selecting a tag for released version or
|
| 103 | trunk for the current development code, or unpack a source package. The
|
| 104 | location where the source has been placed will be referred as
|
| 105 | ${tomcat.source}.
|
| 106 |
|
| 107 | (2.2) Building
|
| 108 |
|
| 109 | * Go to that directory, and do:
|
| 110 |
|
| 111 | cd ${tomcat.source}
|
| 112 | ant download
|
| 113 | ant
|
| 114 |
|
| 115 | * WARNING: Running "ant download" command will download libraries required
|
| 116 | to build Tomcat to the /usr/share/java directory. On a typical Linux or
|
| 117 | MacOX system an ordinary user will not have access to write to this
|
| 118 | directory, and, even if you do, it may not be appropriate for you to
|
| 119 | write there.
|
| 120 |
|
| 121 | On Windows this usually corresponds to the "C:\usr\share\java"
|
| 122 | directory, unless Cygwin is used. Read below to learn how to customize
|
| 123 | the directory used to download the binaries.
|
| 124 |
|
| 125 | * NOTE: Users accessing the Internet through a proxy must use a properties
|
| 126 | file to indicate to Ant the proxy configuration. Read below.
|
| 127 |
|
| 128 | * The build can be controlled by creating a ${tomcat.source}/build.properties
|
| 129 | file, and adding the following content to it:
|
| 130 |
|
| 131 | # ----- Proxy setup -----
|
| 132 | # Uncomment if using a proxy server
|
| 133 | #proxy.host=proxy.domain
|
| 134 | #proxy.port=8080
|
| 135 | #proxy.use=on
|
| 136 |
|
| 137 | # ----- Default Base Path for Dependent Packages -----
|
| 138 | # Replace this path with the directory path where dependencies binaries
|
| 139 | # should be downloaded
|
| 140 | base.path=/home/me/some-place-to-download-to
|
| 141 |
|
| 142 |
|
| 143 | (3) Updating sources
|
| 144 |
|
| 145 | It is recommended that you regularly update the downloaded Tomcat 6 sources
|
| 146 | using your SVN client.
|
| 147 |
|
| 148 | (4) Rebuilds
|
| 149 |
|
| 150 | For a quick rebuild of only modified code you can use:
|
| 151 |
|
| 152 | cd ${tomcat.source}
|
| 153 | ant
|
| 154 |
|
| 155 | (5) Building the servlet and jsp API documentation
|
| 156 |
|
| 157 | cd ${tomcat.source}
|
| 158 | ant -f dist.xml dist-javadoc
|
| 159 |
|
| 160 | (6) Building the extras (commons-logging, webservices etc.).
|
| 161 |
|
| 162 | cd ${tomcat.source}
|
| 163 | ant -f extras.xml
|
| 164 |
|
| 165 | (7) Building a release:
|
| 166 |
|
| 167 | cd ${tomcat.source}
|
| 168 | ant -f dist.xml release
|