首页 > 代码库 > 自己动手编译apache-tomcat-6.0.41-src源码

自己动手编译apache-tomcat-6.0.41-src源码

第一步:下载apache-tomcat-6.0.41-src

第二步:阅读BUILDING.txt。了解所需要的步骤。

In order to build a binary distribution version of Apache Tomcat from a source distribution, do the following:

(0) Download and Install a Java Development Kit

因为tomcat依赖于apache dbcp 源码进行编译,而dbcp依赖于JDBC规范,而不同的jdk之间JDBC规范定义的接口可能有出入。所以,这里推荐使用jdk1.5。

(1) Install Apache Ant 1.6.x on your computer

(2) Building Tomcat 6.0

(2.1) Checkout or obtain the source code for Tomcat 6.0

* Tomcat 6.0 SVN repository URL: http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/

(2.2) Building

* Go to that directory, and do:

cd ${tomcat.source}
ant download
ant

(3) Updating sources

It is recommended that you regularly update the downloaded Tomcat 6 sources using your SVN client.

(4) Rebuilds

For a quick rebuild of only modified code you can use: 

cd ${tomcat.source}
ant

(5) Building the servlet and jsp API documentation

cd ${tomcat.source}
ant -f dist.xml dist-javadoc

(6) Building the extras (commons-logging, webservices etc.).

cd ${tomcat.source}
ant -f extras.xml

(7) Building a release:

cd ${tomcat.source}
ant -f dist.xml release

 

第三步:准备工作,安装配置JDK/ANT。

C:\Users\wsc>echo %java_home%D:\wsc\Program Files (x86)\Java\jdk1.5.0_22C:\Users\wsc>echo %ant_home%D:\wsc\software\apache-ant-1.6.5-binC:\Users\wsc>

第四步:按照tortoise SVN,check out code。

D:\wsc\software\tomcat6.0.x>dir 驱动器 D 中的卷是 新加卷 卷的序列号是 D035-1040 D:\wsc\software\tomcat6.0.x 的目录2014/06/28  10:47    <DIR>          .2014/06/28  10:47    <DIR>          ..2014/06/28  10:36             1,136 .gitignore2014/06/28  10:36    <DIR>          bin2014/06/28  10:36             8,880 build.properties.default2014/06/28  10:36            36,756 build.xml2014/06/28  10:36             6,215 BUILDING.txt2014/06/28  10:36    <DIR>          conf2014/06/28  10:36            30,737 dist.xml2014/06/28  10:36             1,551 eclipse.classpath2014/06/28  10:36             1,191 eclipse.project2014/06/28  10:36            16,763 extras.xml2014/06/28  10:36    <DIR>          java2014/06/28  10:36            32,598 KEYS2014/06/28  10:36            57,695 LICENSE2014/06/28  10:36               783 NOTICE2014/06/28  11:20    <DIR>          output2014/06/28  10:36             9,363 RELEASE-NOTES2014/06/28  10:36             2,385 RELEASE-PLAN-6.0.txt2014/06/28  10:36    <DIR>          res2014/06/28  10:36            16,861 RUNNING.txt2014/06/28  10:36             2,764 STATUS.txt2014/06/28  10:36    <DIR>          test2014/06/28  10:36    <DIR>          webapps              15 个文件        225,678 字节               9 个目录 773,780,836,352 可用字节

 

第五步:在tomcat6.0.x(x表示开发6.0版本下的最新版本)运行ant download,下载所需要的jar包依赖,第一次下载可能需要几分钟。

D:\wsc\software\tomcat6.0.x>ant downloadBuildfile: build.xmlbuild-manifests:     [copy] Copying 10 files to D:\wsc\software\tomcat6.0.x\output\manifestsdownload:testexist:     [echo] Testing  for /usr/share/java/tomcat-native-1.1.30/tomcat-native.tar.gzdownloadfile-2:testexist:     [echo] Testing  for /usr/share/java/tomcat-native-1.1.30/LICENSEdownloadzip-2:proxyflags:setproxy:testexist:     [echo] Testing  for /usr/share/java/commons-daemon-1.0.15/commons-daemon-1.0.15.jardownloadgz-2:testexist:     [echo] Testing  for /usr/share/java/commons-daemon-1.0.15/commons-daemon-1.0.15-native-src.tar.gzdownloadfile-2:testexist:     [echo] Testing  for /usr/share/java/commons-daemon-1.0.15/windows/prunmgr.exedownloadzip-2:proxyflags:setproxy:testexist:     [echo] Testing  for /usr/share/java/commons-pool-1.5.7-src/build.xmldownloadgz-2:proxyflags:setproxy:testexist:     [echo] Testing  for /usr/share/java/commons-dbcp-1.3-src/build.xmldownloadgz-2:build-manifests:     [copy] Copying 10 files to D:\wsc\software\tomcat6.0.x\output\manifestsbuild-tomcat-dbcp:     [copy] Copying 64 files to D:\usr\share\java\tomcat6-deps\dbcp     [move] Moving 64 files to D:\usr\share\java\tomcat6-deps\dbcp\src\java\org\apache\tomcat\dbcp    [javac] Compiling 64 source files to \usr\share\java\tomcat6-deps\dbcp\classes    [javac] 注意:某些输入文件使用或覆盖了已过时的 API。    [javac] 注意:要了解详细信息,请使用 -Xlint:deprecation 重新编译。    [javac] 注意:某些输入文件使用了未经检查或不安全的操作。    [javac] 注意:要了解详细信息,请使用 -Xlint:unchecked 重新编译。      [jar] Building jar: D:\usr\share\java\tomcat6-deps\dbcp\tomcat-dbcp.jartestexist:     [echo] Testing  for /usr/share/java/ecj-4.3.1/ecj-4.3.1.jardownloadfile-2:proxyflags:setproxy:testexist:     [echo] Testing  for /usr/share/java/nsis-2.46/makensis.exedownloadzip:BUILD SUCCESSFULTotal time: 3 seconds

在windows下默认的依赖jar的保存路径为:

D:\usr\share\java>dir 驱动器 D 中的卷是 新加卷 卷的序列号是 D035-1040 D:\usr\share\java 的目录2014/06/28  11:19    <DIR>          .2014/06/28  11:19    <DIR>          ..2014/06/28  11:19    <DIR>          avalon-framework-4.1.32014/06/28  10:52    <DIR>          commons-daemon-1.0.152014/06/28  10:52    <DIR>          commons-dbcp-1.3-src2014/06/28  11:19    <DIR>          commons-logging-1.1.12014/06/28  10:52    <DIR>          commons-pool-1.5.7-src2014/06/28  10:52    <DIR>          ecj-4.3.12014/06/28  11:19    <DIR>          jaxrpc-1.1-rc42014/06/28  11:19    <DIR>          log4j-1.2.122014/06/28  11:19    <DIR>          logkit-1.0.12014/06/28  10:55    <DIR>          nsis-2.462014/06/28  11:19    <DIR>          servletapi-2.32014/06/28  10:52    <DIR>          tomcat-native-1.1.302014/06/28  10:52    <DIR>          tomcat6-deps2014/06/28  11:19    <DIR>          wsdl4j-1.6.1               0 个文件              0 字节              16 个目录 773,780,312,064 可用字节

 

第六步:运行ant命令。

结果如下:

D:\wsc\software\tomcat6.0.x>antBuildfile: build.xmlbuild-prepare:    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\classes    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\build    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\build\bin    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\build\conf    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\build\lib    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\build\logs    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\build\temp    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\build\webappscompile:    [javac] Compiling 1090 source files to D:\wsc\software\tomcat6.0.x\output\classes    [javac] 注意:某些输入文件使用或覆盖了已过时的 API。    [javac] 注意:要了解详细信息,请使用 -Xlint:deprecation 重新编译。    [javac] 注意:某些输入文件使用了未经检查或不安全的操作。    [javac] 注意:要了解详细信息,请使用 -Xlint:unchecked 重新编译。     [copy] Copying 182 files to D:\wsc\software\tomcat6.0.x\output\classes     [copy] Copying 6 files to D:\wsc\software\tomcat6.0.x\output\classes\javax\servlet\resourcesbuild-manifests:    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\manifests     [copy] Copying 10 files to D:\wsc\software\tomcat6.0.x\output\manifestspackage:      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\annotations-api.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\servlet-api.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\jsp-api.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\el-api.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\bin\bootstrap.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\bin\tomcat-juli.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\catalina.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\catalina-tribes.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\catalina-ha.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\catalina-ant.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\tomcat-coyote.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\jasper.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\jasper-el.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\tomcat-i18n-es.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\tomcat-i18n-fr.jar      [jar] Building jar: D:\wsc\software\tomcat6.0.x\output\build\lib\tomcat-i18n-ja.jarbuild-only:build-docs:     [copy] Copying 27 files to D:\wsc\software\tomcat6.0.x\output\build\webapps     [copy] Copying 2 files to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs     [copy] Copying 1 file to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs     [copy] Copying 1 file to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\appdev\sample    [mkdir] Created dir: D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs     [xslt] Transforming into D:\wsc\software\tomcat6.0.x\output\build\webapps\docs     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\aio.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\aio.html     [xslt] Loading stylesheet D:\wsc\software\tomcat6.0.x\webapps\docs\tomcat-docs.xsl     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\apr.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\apr.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\balancer-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\balancer-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\building.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\building.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\cgi-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\cgi-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\changelog.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\changelog.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\class-loader-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\class-loader-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\cluster-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\cluster-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\connectors.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\connectors.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\default-servlet.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\default-servlet.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\deployer-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\deployer-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\developers.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\developers.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\extras.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\extras.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\html-manager-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\html-manager-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\index.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\index.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\introduction.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\introduction.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\jasper-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\jasper-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\jndi-datasource-examples-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\jndi-datasource-examples-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\jndi-resources-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\jndi-resources-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\logging.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\logging.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\manager-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\manager-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\maven-jars.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\maven-jars.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\mbeans-descriptor-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\mbeans-descriptor-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\monitoring.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\monitoring.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\proxy-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\proxy-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\realm-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\realm-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\security-manager-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\security-manager-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\setup.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\setup.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\ssi-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\ssi-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\ssl-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\ssl-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\virtual-hosting-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\virtual-hosting-howto.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\windows-service-howto.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\windows-service-howto.html     [xslt] Transforming into D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\appdev     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\appdev\deployment.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\appdev\deployment.html     [xslt] Loading stylesheet D:\wsc\software\tomcat6.0.x\webapps\docs\tomcat-docs.xsl     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\appdev\index.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\appdev\index.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\appdev\installation.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\appdev\installation.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\appdev\introduction.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\appdev\introduction.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\appdev\processes.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\appdev\processes.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\appdev\source.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\appdev\source.html     [xslt] Transforming into D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\fs-admin-apps.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\fs-admin-apps.html     [xslt] Loading stylesheet D:\wsc\software\tomcat6.0.x\webapps\docs\tomcat-docs.xsl     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\fs-admin-objects.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\fs-admin-objects.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\fs-admin-opers.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\fs-admin-opers.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\fs-default.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\fs-default.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\fs-invoker.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\fs-invoker.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\fs-jdbc-realm.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\fs-jdbc-realm.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\fs-jndi-realm.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\fs-jndi-realm.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\fs-memory-realm.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\fs-memory-realm.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\index.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\index.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\funcspecs\mbean-names.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\funcspecs\mbean-names.html     [xslt] Transforming into D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\ajp.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\ajp.html     [xslt] Loading stylesheet D:\wsc\software\tomcat6.0.x\webapps\docs\tomcat-docs.xsl     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster-channel.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster-channel.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster-deployer.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster-deployer.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster-interceptor.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster-interceptor.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster-listener.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster-listener.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster-manager.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster-manager.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster-membership.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster-membership.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster-receiver.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster-receiver.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster-sender.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster-sender.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster-valve.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster-valve.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\cluster.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\cluster.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\context.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\context.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\engine.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\engine.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\executor.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\executor.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\filter.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\filter.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\globalresources.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\globalresources.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\host.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\host.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\http.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\http.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\index.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\index.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\listeners.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\listeners.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\loader.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\loader.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\manager.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\manager.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\realm.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\realm.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\resources.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\resources.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\server.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\server.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\service.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\service.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\systemprops.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\systemprops.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\config\valve.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\config\valve.html     [xslt] Transforming into D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\architecture     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\architecture\index.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\architecture\index.html     [xslt] Loading stylesheet D:\wsc\software\tomcat6.0.x\webapps\docs\tomcat-docs.xsl     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\architecture\overview.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\architecture\overview.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\architecture\requestProcess.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\architecture\requestProcess.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\architecture\startup.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\architecture\startup.html     [xslt] Transforming into D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\tribes     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\tribes\developers.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\tribes\developers.html     [xslt] Loading stylesheet D:\wsc\software\tomcat6.0.x\webapps\docs\tomcat-docs.xsl     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\tribes\faq.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\tribes\faq.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\tribes\interceptors.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\tribes\interceptors.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\tribes\introduction.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\tribes\introduction.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\tribes\membership.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\tribes\membership.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\tribes\setup.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\tribes\setup.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\tribes\status.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\tribes\status.html     [xslt] Processing D:\wsc\software\tomcat6.0.x\webapps\docs\tribes\transport.xml to D:\wsc\software\tomcat6.0.x\output\build\webapps\docs\tribes\transport.htmlwarn.dbcp:deploy:     [copy] Copying 1 file to D:\wsc\software\tomcat6.0.x\output\build\bin     [copy] Copying 1 file to D:\wsc\software\tomcat6.0.x\output\build\bin     [copy] Copying 1 file to D:\wsc\software\tomcat6.0.x\output\build\bin     [copy] Copying 1 file to D:\wsc\software\tomcat6.0.x\output\build\bin     [copy] Copying 17 files to D:\wsc\software\tomcat6.0.x\output\build\bin     [copy] Copying 7 files to D:\wsc\software\tomcat6.0.x\output\build\conf     [copy] Copying 208 files to D:\wsc\software\tomcat6.0.x\output\build\webapps     [copy] Copying 2 files to D:\wsc\software\tomcat6.0.x\output\build\webapps     [copy] Copying 1 file to D:\wsc\software\tomcat6.0.x\output\build\webapps\ROOT    [javac] Compiling 43 source files to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\WEB-INF\classes    [javac] 注意:D:\wsc\software\tomcat6.0.x\webapps\examples\WEB-INF\classes\compressionFilters\CompressionServletResponseWrapper.java 使用或覆盖了已过时的 API。    [javac] 注意:要了解详细信息,请使用 -Xlint:deprecation 重新编译。    [javac] 注意:某些输入文件使用了未经检查或不安全的操作。    [javac] 注意:要了解详细信息,请使用 -Xlint:unchecked 重新编译。    [javac] Compiling 1 source file to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\plugin\applet [txt2html] Converted 1 file to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\jsp2\simpletag [txt2html] Converted 4 files to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\jsp2\simpletag [txt2html] Converted 5 files to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\jsp2\simpletag [txt2html] Converted 1 file to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\jsp2\jspattribute [txt2html] Converted 4 files to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\jsp2\jspattribute [txt2html] Converted 4 files to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\cal [txt2html] Converted 1 file to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\jsptoserv [txt2html] Converted 1 file to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\jsp2\el [txt2html] Converted 1 file to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\jsp2\misc [txt2html] Converted 4 files to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples\jsp\jsp2\tagfiles [txt2html] Converted 47 files to D:\wsc\software\tomcat6.0.x\output\build\webapps\examples     [copy] Copying 1 file to D:\wsc\software\tomcat6.0.x\output\build\lib     [copy] Copying 1 file to D:\wsc\software\tomcat6.0.x\output\build\libBUILD SUCCESSFULTotal time: 12 secondsD:\wsc\software\tomcat6.0.x>

第七步:测试。

在目录D:\wsc\software\tomcat6.0.x\output\build\bin下面,运行startup.bat,正常启动。

 

第八步:修改tomcat源码,再build,查看效果。

修改D:\wsc\software\tomcat6.0.x\java\org\apache\catalina\startup\Bootstrap.java文件的main方法如下:

    public static void main(String args[]) {//add start by wsc( 2014.06.28)System.out.println(new java.util.Date());System.out.println("==============================================================================");for(String s : args) {    System.out.println(s);}    System.out.println("==============================================================================");    System.out.println("==============================================================================");    System.out.println("==============================================================================");    //add end by wsc( 2014.06.28)        if (daemon == null) {            daemon = new Bootstrap();            try {                daemon.init();            } catch (Throwable t) {                t.printStackTrace();                return;            }        }

运行ant命令重新编译...

运行startup.bat的控制台输出如下:

 运行shutdown.bat输出如下:

D:\wsc\software\tomcat6.0.x\output\build\bin>shutdown.batUsing CATALINA_BASE:   "D:\wsc\software\tomcat6.0.x\output\build"Using CATALINA_HOME:   "D:\wsc\software\tomcat6.0.x\output\build"Using CATALINA_TMPDIR: "D:\wsc\software\tomcat6.0.x\output\build\temp"Using JRE_HOME:        "D:\wsc\Program Files (x86)\Java\jdk1.5.0_22"Using CLASSPATH:       "D:\wsc\software\tomcat6.0.x\output\build\bin\bootstrap.jar"Sat Jun 28 12:52:13 CST 2014==============================================================================stop==========================================================================================================================================================================================================================================