If you need to learn Tomcat 7 source, the last method is to import the source into the IDE environment, tracking, debugging, testing, and so on, here to talk about how to import Tomcat 7 source.
First, install Ant
Tamcat source using ant build, if not installed ant, you can download the installation from the following URL: http://ant.apache.org/bindownload.cgi
Unzip the zip package directly, such as extract to D:\Program files\apache-ant-1.9.4, then add two environment variables:
1, Ant_home D:\Program files\apache-ant-1.9.4 (hereinafter referred to as the $ant _home$ of this directory)
2, Path $ANT _home$\bin (if path already exists, directly after the original variable is added)
To verify that the successful method is installed, enter: ant–version in the cmd window. If the ant version information is successfully exported, the installation is successful.
Ii. construction of the Tomcat project
Next, check out the Tomcat source from SVN, url: http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/(You can also choose a different version of the Tomcat source, note that Different versions of the Tomcat source, the JDK version requirements, such as Tomcat 7 depends on the Jdk6,tomcat 6 dependent Jdk5, the wrong version of the JDK will not be able to build the Tomcat project.
Because you import Tomcat 7 source, you should use JDK6, and note that you cannot select 7 or another version. Let's assume that the source of check out is in G:\dataJavaWeb\tomcat\tomcat7.0.x (the specific location can be set at its own discretion, the following will refer to this directory as $tomcat _src$).
View $tomcat _src$/build.properties.default, copy one, change to Build.properties, under this file: There is a base.path (Ant project Library, default is/usr/share/java) , if you do not like this path, you can modify it, such as: E:/ant_repository
Next, enter the CMD window and enter the following command:
CD $tomcat _src$
Ant Ide-eclipse
If you see build successfully at the end, it indicates that the project was built successfully, instead, look for the wrong reason. Successfully build the project, will be in the $tomcat_src$ a folder output, the project build compiled code is in the folder.
Third, import projects
The final step is import: Open Eclipse and import tomcat source.
1. Select Import
2. Choose existing projects into Worksapce,next
3. In root directory, select $tomcat _src$,next
4. Project Select Java Project (some SVN does not need this option)
5, OK finish.
Tomcat source provides commands for running and stopping Tomcat in the $tomcat _src$/res/ide-support/eclipse. You can click to run in Org.apache.catalina.startup.Bootstrap.
Report:
Because of the ant build, some of the configuration files may not be built (see $tomcat _src$/output/build}, the missing profile can be copied directly from the source, or you can refactor the build project by configuring Build.properties.
Wish you a happy study!
Eclipse Import Tomcat 7 source