First, download the source code
Enter the official website http://tomcat.apache.org, click Download>tomcat9>source Code distributions>zip Download and unzip
Or check out the source code from the SVN repository, SVN path http://svn.apache.org/repos/asf/tomcat/trunk
After extracting or checking out, the directory is as follows and cannot be imported directly at this time
Second, ant compilation
1. Click Https://mirrors.tuna.tsinghua.edu.cn/apache//ant/binaries/apache-ant-1.10.1-bin.zip to download Ant's Zip installation package and extract it to d:/ Ant and create a new environment variable path, pointing to the extracted bin directory D:\ant\apache-ant-1.10.1\bin
2, (optional, because ant in the build process will download the dependent jar package, where you can modify the storage location of the jar package) Open the first step of the source directory, edit Build.properties.default
Locate Base.path, specify a custom directory, such as Base.path=d:/ant/tomcat-build-libs (new folder)
3. Under the Tomcat source directory, execute command line ant ide-eclipse
This process takes about 10 seconds until the output build successful. At this point, the. Project. classpath file is generated under this directory
Third, open Eclipse, menu Window>perference>java>build path>classpath Variables
1. New Ant_home and Tomcat_libs_base variables, Ant_home points to the ANT installation directory, such as d:/ant/apache-ant-1.10.1. Tomcat_libs_base points to the Base.path directory d:/ant/tomcat-build-libs configured above. If no changes are made, use the directory that the Base.path defaults to
2, import Tomcat source code, import>existing Projects into Workspace. At this time the project normal import, no error
3. Right-click Build.xml,run as > Ant build Build successful
4. Right-click Project, Run as > Java application>bootstrap>start-tomcat
Ok
Tomcat Source Learning one: import eclipse