Building Tomcat7 source step by step---官方文档

Table of Contents
Introduction

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.

Download a Java Development Kit (JDK) version 6

Building Apache Tomcat requires a JDK (version 6) to be installed. You can download one from
http://www.oracle.com/technetwork/java/javase/downloads/index.html
or from another JDK vendor.

IMPORTANT: Set an environment variable JAVA_HOME to the pathname of the directory into which you installed the JDK release.

Install Apache Ant 1.8.1 or later

Download a binary distribution of Ant 1.8.1 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.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.

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 available, which will be used to actually perform the build.

Checkout or obtain the source code for Tomcat 7.0

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

Tomcat source packages: http://tomcat.apache.org/download-70.cgi.

Checkout the source using SVN, selecting a tag for released version or trunk for the current development code, 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.

Building Tomcat

Use the following commands to build Tomcat:

cd ${tomcat.source}
ant

WARNING: Running this command will download libraries required to build Tomcat to the /usr/share/java directory by default. On a typical Linux or MacOX system, an ordinary user will not have access to write to this directory, and, even if you do, it is likely not appropriate for you to write there. On Windows this usually corresponds to theC:\usr\share\java directory, unless Cygwin is used. Read below to learn how to customize the directory used to download the binaries.

NOTE: Users accessing the Internet through a proxy must use a properties file to indicate to Ant the proxy configuration. Read below for details.

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.
#proxy.host=proxy.domain
#proxy.port=8080
#proxy.use=on

# ----- Default Base Path for Dependent Packages -----
# Replace this path with the directory path where
# dependencies binaries should be downloaded.
base.path=/home/me/some-place-to-download-to

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.

Building with Eclipse

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. However, some developers like to work on Java code with a Java IDE, and the following steps have been used by some developers.

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.

WARNING: Do not forget to create and configure ${tomcat.source}/build.properties file as described above before running any Ant targets.

Sample Eclipse project files and launch targets are provided in the res/ide-support/eclipse directory of the source tree. The instructions below will automatically copy these into the required locations.

An Ant target is provided as a convenience to download all binary dependencies, and to create the Eclipse project and classpath files in the root of the source tree. 

cd ${tomcat.source}
ant ide-eclipse

Start Eclipse and create a new Workspace.

Open the Preferences dialog and then select Java->Build Path->Classpath Variables to add two new Classpath Variables:

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

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.

start-tomcat and stop-tomcat launch configurations are provided in res/ide-support/eclipse 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.Bootstrap as the main class, start/stop etc. as program arguments, and specify -Dcatalina.home=... (with the name of your build directory) as VM arguments.

Tweaking a few formatting preferences will make it much easier to keep consistent with Tomcat coding conventions (and have your contributions accepted):

Java -> Code Style -> Formatter -> Edit... Tab policy: Spaces only
Tab and Indentation size: 4
General -> Editors -> Text Editors Displayed tab width: 2
Insert spaces for tabs
Show whitespace characters (optional)
XML -> XML Files -> Editor Indent using spaces
Indentation size: 2
Ant -> Editor -> Formatter Tab size: 2
Use tab character instead of spaces: unchecked
Building with other IDEs

The same general approach should work for most IDEs; it has been reported to work in IntelliJ IDEA, for example.

原文地址:http://tomcat.apache.org/tomcat-7.0-doc/building.html#Building_with_Eclipse

时间: 2024-11-01 04:33:47

Building Tomcat7 source step by step---官方文档的相关文章

hbase官方文档(转)

Apache HBase™ 参考指南  HBase 官方文档中文版 Copyright © 2012 Apache Software Foundation.保留所有权利. Apache Hadoop, Hadoop, MapReduce, HDFS, Zookeeper, HBase 及 HBase项目 logo 是Apache Software Foundation的商标. Revision History Revision 0.95-SNAPSHOT 2012-12-03T13:38 中文版

【android官方文档】与其他App交互

发送用户到另外一个App YOU SHOULD ALSO READ 内容分享 One of Android's most important features is an app's ability to send the user to another app based on an "action" it would like to perform. For example, if your app has the address of a business that you'd

Jinja2学习笔记暨官方文档的翻译

http://blog.csdn.net/lgg201/article/details/4647471 呵呵, 刚刚看完Python模板引擎Jinja2的文档, 感觉很好, 觉得动态语言真是很好.  模板引擎竟然可以做的如此灵活....真是不错.... 下面直接把看文档过程的笔记发布出来, 呵呵, 基本上就是翻译, 加了不多的一点自己的解释......希望可以帮到大家 补充: 1. 在模板中设置自定义变量: {% set variable_name = value %} 比如设置{% set u

OpenGL ES着色器语言之语句和结构体(官方文档第六章)内建变量(官方文档第七、八章)

OpenGL ES着色器语言之语句和结构体(官方文档第六章) OpenGL ES着色器语言的程序块基本构成如下: 语句和声明 函数定义 选择(if-else) 迭代(for, while, do-while) 跳跃(discard, return, break, continue) 6.1函数定义   着色器是由一系列全局声明和函数定义组成的.函数声明规范如下: // prototype returnType functionName (type0 arg0, type1 arg1, ...,

HBase 官方文档0.90.4

HBase 官方文档0.90.4 Copyright ? 2010 Apache Software Foundation, 盛大游戏-数据仓库团队-颜开(译) Revision History Revision 0.90.4 配置,数据模型使用入门 Abstract 这是 Apache HBase的官方文档, Hbase是一个分布式,版本化(versioned),构建在 Apache Hadoop和 Apache ZooKeeper上的列数据库. 我(译者)熟悉Hbase的源代码,从事Hbase

Matlab最新的官方文档中文翻译

文章翻译的是Matlab最新的官方文档R2016b,可能后续如果我还有时间会继续翻译,希望能够帮到大家,翻译的不好请大家不要吐槽. Matlab官方文档地址:http://cn.mathworks.com/help/pdf_doc/matlab/getstart.pdf Desktop Basics  当您启动MATLAB时,桌面以其默认布局显示如下: 说明:请大家对照着英文原版看,我没有截图,因为实在太麻烦 桌面包括以下面板: ?当前文件夹 - 访问您的文件. ?命令窗口 - 在命令行中输入命

第0001题 : 产生随机数(顺便读random模块官方文档)

看这个之前我准备先看一下random模块的官方文档... 在整个随机模块中,  最基础的就是random, 它产生一个 [0.0, 1.0)的浮点数. 这个模块下所有的函数实际上是绑定在一个叫做random.Ramdom的类的隐藏实例下的, 当然你可以自己实例化这个类从而得到新的随机数生成器, 同时random模块下还有一个叫做SystemRandom的类, 它使用系统函数 os.urandom()用操作系统提供的随机资源来来产生随机数.(不知所云...) 只挑了一部分看起来有用的函数... r

EasyTouch的使用官方文档操作步骤

对于移动平台上的RPG类的游戏,我们常用虚拟摇杆来控制人物角色的行走和一些行为,相信我们对它并不陌生,之前尝试了EasyTouch2.5,发现并没有最新版的3.1好用,2.5版本的对于自适应没有做的很好,而最新版的已经解决了这一问题.当然unity也自带了摇杆Joystick,用起来也简单,但存在不少局限,不会满足普通mmo游戏的需求,比如指定显示区域或者是更改一些素材等等,而这些EasyTouch插件都已经帮你实现,不得不佩服插件的原作者,能做出这么炫酷好用的插件,当然这估计是老外开发的,关于

Google 官方文档解析之——Application Fundamentals

Android apps are written in the java programming language.The Android SDK tools compile your code-along with any data and resource file-into an APK:an Android package,which is an archive file with an .apk suffix.One APK file contains all the contents

(一)Kafka0.8.2官方文档中文版系列-入门指南

写在前面的话 本系列文章仅仅代表个人的观点,结合自己的学习.使用经验,将kafka0.8.2官方文档,进行翻译,目录结构按照官方文档进行排版. 目的: 系统梳理下kafka知识点,从整体上重新认识下kafka 与广大网友进行交流,内容中难免有不合适的地方,还请大家不吝赐教,我会及时更正 尽一点点微薄之力,去帮助一些人,大家共同进步 一.Getting Started 1.1  Introduction(简介) Kafka是一个分布式.分区的.数据备份的日志收集系统.Kafka使用了一种的独特的方