Reference: http://www.cnblogs.com/lanxuezaipiao/p/3640923.html
1, from the Tomcat official website (http://tomcat.apache.org/) Download source code apache-tomcat-8.0.26-src.zip.
2. Download the project build tool Ant (http://ant.apache.org/). After decompression, configure the environment variable and modify the path value. For example, ant_home= "D:\Program files\apache foundation\apache-ant-1.9.6", path= "...; %ant_home%\bin ".
3, unzip the file source code to eclipse workspace. And, under the cmd command line, check to see if Ant is installed. (c:\user\> ant-version)
4, find the path of the tomcat-8.0.26, modify the path of the Build.properties.default file, (usually modified file name is Build.properties).
Found 71 rows or so: Base.path=/usr/share/java for base.path= "source Path/repository" (customizable), when building the project, will download some of the dependencies will be downloaded to this directory.
4. On the cmd command line, enter the command ant under the folder under the source of the tomcat8.0.26 that you just unzipped. Build start ...
5, after the completion of the construction, the directory will generate two folder output and repository.
6. Open Eclipse. Create a new Java project apache-tomcat-8.0.26. Right-click Src folder, import > file system Select Source Path
Select the Java folder and the Test folder.
7. In the Java project, select Java and test right-click Build path > use as source folder.
8, there will be a lot of red forks in the project, because of the lack of the corresponding dependent jar package. Under the Java project, create a new lib (for storing other dependent jar packages) folder, conf (for the Tomcat Configuration) folder.
9, download the dependent jar package. (Http://pan.baidu.com/s/1dDz1FMD). Add to the Lib folder, and then build path. Also, add JUNIT4. Copy the contents of the Conf under the source code to the Project Conf folder.
10, after adding, there are some errors, manually modified under (commented out) ... (Specific reasons, no research ...)
11. Find Org.apache.catalina.startup.Bootstrap.java, then Run as Java application.
Finish
Eclipse compiled tomcat8.0.26 's source code