导入Tomcat的源代码,其实很简单,可是如果没有找到正确的方法,你会浪费大量的时间,我就是浪费了好多时间在配置编译环境上。最正确的办法是到Tomcat的官方网址去找到答案。


可以参考下边的连接,这个是关于Tomcat7的。

​http://tomcat.apache.org/tomcat-7.0-doc/building.html​


1. 设置环境

1.1 JDK1.6 or above          

1.2 Ant 1.8.1 or later ANT_HOME


2. Check out the latest tomcat source code

svn --force export http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_11/ D:\Tomcat7\


上边的命令SVN会把最新的Tomcat7011的源码下载到你的硬盘D:\Tomcat7\ 下
SVN 下载地址 http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91


3. 为Eclipse编译工程

[注] a. ${tomcat.source}

build.properties 中设置的 ${base.path}

4. 设置Eclipse 环境 (Class-path Variables)

  TOMCAT_LIBS_BASE 要指向 ${base.path}

5. 导入工程

File -> Import and choose Existing Projects into Workspace

6. 编译问题

往往我们在这时会遇到一些编译错误,这是因为我们Eclipse中JRE环境设置的不正确,需要调整

 

Window -> Preferences -> Java -> Complier -> JDK Compliance -> 6.0 (1.6)

 

下载Tomcat源码,并作为工程导入到Eclipse中_tomcat

     7. 最周到的服务

下载Tomcat源码,并作为工程导入到Eclipse中_eclipse_02