Build Apache Tomcat 6.0 servlet/jsp Container
This subproject contains the source code for Tomcat 6.0, a container that implements the Servlet2.5 and JSP2.1 standards for the Java Community Process http://www.jcp.org/.
Note: If you only need to run Tomcat, there is no need to build it, you can easily download a binary release package. It is cross-platform. Read the RUNNING.txt file, which describes how to run it.
Follow these steps to build a Tomcat binary release from source code:
-
Download and install the JDK
- If the JDK is already installed, skip to step 2
- Download a Java Development Kit (JDK) from the address below, using the Java SE 5 release. Http://www.oracle.com/technetwork/java/javase/downloads/index.html
Newer than Java SE 5 Note:
Because additional documentation indicates that Apache One of the components of Tomcat includes a copy of the private Apache Commons DBCP class Library, which has been downloaded and processed and compiled by the build script (renaming the packages).
because the versions of the Java SE specification differ from the implementation of the JDBC interface, the library has to point to a specific version of Java and compile using the implementation specification of this version of the JDK.
For more information about the available versions of this library and the required conditions, see the Apache Commons dbcp Project's web site
http://commons.apache.org/dbcp/
You can build Tomcat 6.0 with a newer version of the JDK, but the build of the Tomcat-dbcp.jar component will skip and print some warnings.
- installs the JDK based on the introduction that is included in the release package.
- sets an environment variable named Java_home that points to the directory where you installed the JDK release package.
Install Apache Ant 1.8.x on your PC
- If Apache Ant 1.8.x is already installed on your computer, skip to step 3
- Download the Apache Ant 1.8.x binary release package, address:
http://ant.apache.org/bindownload.cgi
- Unzip the binary release package to a suitable location so that the ant Publisher can have its own directory (named "apache-ant-[version]"). The ant publish package full directory pathname is replaced with the symbol "${ant.home}" below this document.
- Create a Ant_home environment variable to the directory ${ant.home}
- Modify the PATH environment variable to contain the paths of the ${ant.home}/bin directory to the list. This will be available using the Ant Script command, which will play its part in the build process.
Build Tomcat 6.0
Check out or otherwise get the source code for Tomcat 6.0
- Tomcat 6.0SVN Warehouse Address: http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/
- Download the source code package
http://tomcat.apache.org/download-60.cgi
- Use SVN to check out the source code, select a published tag version or the main version of the current development code, or extract a source code package, the source code directory to ${tomcat.source} as the reference name.
Build
Switch to the source code directory and execute the following command:
cd${tomcat.source}ant downloadant
Warning: running the "ant download" command downloads the library files needed to build Tomcat into the/usr/share/java directory. On a typical Linux or MacOS system, even if you do, writing to this directory may not be appropriate for you. On Windows This directory is usually the same as the C:\usr\share\java directory. Unless you're using a cygwin. Read the section below to learn how to customize the download directory for binary files.
- Note: Users who access the Internet through a proxy must use a property file to point to the ant proxy configuration. See below.
- You can control the build by creating a ${tomcat.source}/build.properties file, adding the following to the file:
# ----- 代理设置 ----- # 如何使用代理服务请解除注释 #proxy.host=proxy.domain #proxy.port=8080 #proxy.use=on # ----- 依赖包的默认基准目录 ----- # 替换需要下载的依赖二进制包的下载目录 base.path=/home/me/some-place-to-download-to
Update source code
We recommend that you use the SVN client to update the Tomcat 6 source code regularly
Re-build
You can use the following command to make a simple build of the modified source code
cd${tomcat.source}ant
Building servlet and JSP API documentation
cd${tomcat.source}-f dist.xml dist-javadoc
Additional builds (commons-logging, webservices, etc.)
cd${tomcat.source}-f extras.xml
Build a release version
A complete release package includes the Windows Installer and requires an available Windows environment to create it. If you do not build it in a Windows environment, the build script is also available with wine. If this is not the case, you can set skip.installer
properties to skip the creation of the installer.
cd${tomcat.source}-f dist.xml release
- Other
This article is translated from the BUILDING.txt file in the Tomcat source code directory
Note: Respect the fruits of labor, reproduced please indicate the source, thank you!
Build Apache Tomcat 6.0 servlet/jsp Container