1.安装TortoiseSVN
http://tortoisesvn.net/
2.利用TortoiseSVN下载Tomcat6源码
exoprt http://svn.apache.org/repos/asf/tomcat/tc6.0.x/tags/TOMCAT_6_0_26
(我选择的版本是TOMCAT_6_0_26)
3.编译Tomcat6源码
Tomcat是用ant构建的,首先要安装ant,这里不介绍ant的安装了
从Tomcat的源代码文件找到build.properties.default文件,把名字改为build.properties,打开这个文件找到下面这行:
base.path=/usr/share/java
这个路径是用来存放即将下载的文件的目录,由于我用的是Windows,所以改为适合我的目录:
base.path=D:/Workspace/JEE/workspace/TOMCAT_6_0_26/share
接着在D:\Workspace\JEE\workspace\TOMCAT_6_0_26\src 目录下打开命令行窗口,执行下面命令:
ant download
TOMCAT_6_0_26这个版本目前下载正常,较老版本一些下载链接可能会失效,需要在 build.properties文件中改链接。
都下载了如下文件:
下载完后直接执行 ant 命令就开始编译了
编译完成后会产生一个output目录,到这个目录(D:\Workspace\JEE\workspace\TOMCAT_6_0_26\src\output\build)下看看,怎么样?我们见到了熟悉的Tomcat目录结构,如下图:
4.将Tomcat源码导入Eclipse
打开Eclipse,新建一个Java项目,然后点击“Next”按钮,在“Use default location”中填入D:\Workspace\JEE\workspace\TOMCAT_6_0_26\src
Project name: TOMCAT_6_0_26
然后一路next
接着我们会看到Eclipse拒绝编译该项目,不要着急,这是由于Eclipse找不到该项目指定的库文件。右击该项目弹出菜单选择 "Build Path" -> "Configure Build Path..." -> "Libraries"
Remove下面两项:
ANT_HOME/lib/ant.jar
TOMCAT_LIBS_BASE/...
接着添加如下依赖(Add External JARs...):
(也可以参考:
http://tomcat.apache.org/tomcat-6.0-doc/building.html#Building_with_Eclipse)
ant.jar (在你电脑ant安装目录下lib目录下可以找到)
org.eclipse.jdt.core_3.3.1.v_780_R33x.jar (刚才下载的目录D:\Workspace\JEE\workspace\TOMCAT_6_0_26\share\eclipse\plugins 可以找到)
junit4.7 (这个原来有,我给换成4.7的了)
5.在Eclipse中运行Tomcat
找到org.apache.catalina.startup.Bootstrap
右键 Run as -> Run Configurations...
在Program参数窗口和VM参数窗口分别填入
start
和
-Dcatalina.home="D:\Workspace\JEE\workspace\TOMCAT_6_0_26\src\output\build"
Debug同理,不解释,看图:
从org.apache.jasper.compiler.Compiler类的generateJava()方法开始Debug更好,debug启动Tomcat,然后浏览器输入地址并回车,就会看到如下Debug视图:
注意:generateJava方法是将jsp编译成java class,这个行为只有第一次请求时才会调用,将你再次发送请求时你将看不到这个Debug视图了,解决办法是到Tomcat的 build\work\Catalina\目录删除对应jsp的类文件
接下来,带个好心情,读源码吧,祝快乐
- 大小: 109.1 KB
- 大小: 29.1 KB
- 大小: 37.4 KB
- 大小: 68.3 KB
- 大小: 47.1 KB
- 大小: 62.1 KB
- 大小: 69.1 KB
- 大小: 31.1 KB
- 大小: 50.4 KB
- 大小: 86.3 KB
- 大小: 14.7 KB
- 大小: 14.6 KB
分享到:
相关推荐
[jar] Building jar: D:\java\wsdd\target\MyServices.jar [copy] Copying 1 file to e:\apache-tomcat-7.0.23\webapps\axis\WEB-INF\lib [delete] Deleting directory D:\java\wsdd\target deploy: [java] ...
9. Building Tomcat from Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 Installing Apache Ant 348 Obtaining the Source 349 Downloading Support Libraries 351 ...
My primary interest in open source software (OSS) is in building enterprise information systems using open source components. The maturity of OSS makes this not only possible but easily achievable on ...
Start building Java–based web applications now, even if you’re a complete newcomer to Java. Comprehensive and example–driven, Beginning JSP, JSF, and Tomcat: Java Web Development, Second Edition is...
as described in "BUILDING.txt". If you do this, the value to use for "${catalina.home}" will be the "dist" subdirectory of your source distribution. <br>(2.1) Download a binary distribution ...
In this book, we have attempted to address the needs of two diverse groups of ...might like to get some hands-on experience in building a cluster of Tomcat servers with inexpensive components.
1. Building/Running Spring Applications on SpringSource tc Server?. 2. Widespread Adoption of Spring and Tomcat. 3. What is tc Server?. 4. Spring and tc Server Share Common Philosophy. 5. ...
目录有:backup、bin、conf、lib、logs、temp、webapps、work、BUILDING.txt、CONTRIBUTING.md、LICENSE、NOTICE、RELEASE- NOTES、RUNNING.txt。
The JDOM build system is based on Jakarta Ant, which is a Java building tool originally developed for the Jakarta Tomcat project but now used in many other Apache projects and extended by many ...
系统主要完成以下几个功能...宿舍基本信息(Building):包括宿舍楼编号、宿舍楼性别分类信息、管理员姓名等方面,这样可以方便管理者对宿舍楼的管理,提高查询效率; 4.楼栋管理员基本信息(Teacher):包括工作人员编
Product Description JavaServer Faces (JSF) is the standard Java EE technology for building web user interfaces. It provides a powerful framework for ... as well as servlet runners such as Tomcat 6.
JavaServer Faces (JSF) is the standard Java EE technology for building web user interfaces. It provides a powerful framework for developing server-side ... as well as servlet runners such as Tomcat 6.
Consuming XML-based configuration resources (such as Ant build scripts, web application deployment descriptors, Tomcat's server.xml file). The Java language provides Reflection and Introspection APIs ...
You can use them as a starting point for building your own Google+ applications. They are available for these platforms: Command line Google AppEngine J2EE web application Android To get ...
然后,我们使用Apache Tomcat和Axis2作为接口以及使用Apache Lucene进行反向索引构建了一个Web服务。 最后,我们建立了一个网站,供用户通过集成Web服务,Google Map和建议服务来搜索项目。 此外,我们利用Spark...
You will get your hands dirty with a simple Java project built with Gradle and go on to build web applications that are run with Jetty or Tomcat. We take a unique approach towards explaining the DSL ...
building production-ready Spring applications. Spring Boot favors convention over configuration and is designed to get you up and running as quickly as possible. ###Features Create stand-alone Spring ...
Learn about continuous integration and how it helps in building various Java applications Facilitate the installation and configuration of Jenkins Install and configure code repositories and build ...
1、clone代码到本地2、使用myeclipse中import--exsit maven project,选择刚才下载到的代码路径3、右击项目名,properties-buildPath中需要加入JEE5的包,项目的字符为UTF8格式4、myeclipse会自动building项目,...