Steps to import the Tomcat source into eclipse

Source: Internet
Author: User

Tomcat Source Import Eclipse

First, download the source code

1. Go to Apache official website: http://tomcat.apache.org/

2. Select the source version to download on the left side.

3, or directly through the archives into the source directory

4, the source directory, select the required version,

5, enter the corresponding source code directory to download the corresponding source code, my demo download is 8.026 version of the source code.

Second, Ant compiled source code

If you do not have ant installed, install Ant,ant First is a compilation tool.

Compile step:

1, decompression source compression package

2, set the download location of the dependent package, remove the Build.properties.default file name from the directory in the previous step to extract the suffix default, that is, renamed to Build.properties. Locate the Base.path configuration item in the Build.properties file and change the value of the configuration item to the location path where you want the dependent package to be downloaded.

3, Ctrl+r Open the cmd window, enter the first step after extracting the directory: APACHE-TOMCAT-8.0.26-SRC,

4. Run the command: Ant download, which downloads the packages required for Tomcat compilation. For some reason, I did not succeed in performing this step (it should not be necessary to do this, but there is a lot of information on the web that describes this step), but don't worry about it and go on with the next step.

5, run the command: ant, running this life may take a certain amount of time, because this step needs to download some dependent packages, these dependencies may be on foreign servers, so the download is slow, but also need to compile, compile is more time-consuming. In this step if the command runs to a director time, you can exit with CTRL + C and rerun the Ant command, and if the compilation fails, you can rerun the Ant command compilation until the prompt compilation succeeds.

6, after the successful compilation will be in the directory: APACHE-TOMCAT-8.0.26-SRC, more than a new name for the output of the directory. This is the directory where the compilation results are stored.

Third, import Tomcat source to eclipse

1. Create a new project under Eclipse. Named Tomcat8

2. Import the Java and test two source directories in the extracted directory into the new TOMCAT8 project. Note: Two directories cannot be import at the same time.

3. Mark the Java and test two directories as the source folder, and right-click to select the->build path->use as source folders. An error occurred in both code directories after marking as source folder. This is because a dependent package is missing.

4. Import Dependent Packages:
Ant.jar: Under the ANT directory you installed: Ant_home/lib.
Jaxrpc.jar: Under Eclipse, under the/plugin/javax.xml.rpc_xxx (version number)/lib/directory.
Org.eclipse.jdt.core_3.10.2.v20150120-1634.jar: Under Eclipse's plugin directory. Different versions of Eclipse may have different names.
Wsdl4j-1.5.1.jar: Can be from the Internet.
Right-click Tomcat8->build path->configuration Build Path. Import the above several packages, the Java directory is not wrong, if there are errors in the test directory, you can comment out the wrong file.

5, after the above steps, find Org.apache.catalina.startup under the bootstrap start Tomcat source code, this is unsuccessful. Because there are no Lib and conf folders under the current project path, the server configuration file Server.xml cannot be found, and the server cannot be instantiated, of course. Workaround:

A. Copy the Lib and conf two directories under/build/under the output directory generated by the previous compilation to Tomcat, and you can start directly.

B, two method is to add the VM parameters, specify the specific path of the two folders, with the VM's-D parameter to specify the catalina.home property value to a specific path, as follows:

Run as--run configuration ...-> Arguments in VM Arguments settings:

-dcatalina.home= " E:\Java\Tomcat\apache-tomcat-8.0.26-src\output\build ", then Run It's ready to start. 

Steps to import the Tomcat source into eclipse

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.