In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to create IDEA Tomcat8 source code, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
Preparatory work
The 1.apache-tomcat-8.5.32-src source code package can be downloaded and decompressed on the official website.
Download and install 2.apache-ant-1.10.5 (the latest version): Tomcat source code is compiled by ant by default; configure environment variables after installation
After configuring the environment variable, run ant-version under dos to see if it can be used successfully.
Project creation process
1. Pom.xml file configuration
Because you need to import the project into idea, you need to create the following pom.xml file in the root directory of the source package (that is, under apache-tomcat-8.5.32-src):
4.0.0 org.apache.tomcat Tomcat8.0 Tomcat8.0 8.0 Tomcat8.0 java java org.apache.maven.plugins maven-compiler-plugin 3.1 UTF-8 1.8 1.8 Junit junit 4.12 test org.easymock easymock 3.4 ant ant 1.7.0 wsdl4j wsdl4j 1.6.2 javax.xml jaxrpc 1.1 org.eclipse.jdt.core.compiler ecj 4.5.1
2. Run the ant command to get the folder configuration of catalina-home
In order to get all kinds of folders under catalina-home and use Tomcat successfully, you need to use the ant command to get the folder corresponding to the source package.
1) create a catalina-home folder under the source package folder at the same level
2) enter the command line win+R- > cmd, and enter cd to the root directory of the source code package: that is, under apache-tomcat-8.5.32-src
3) run ant
After running, the folders needed for catalina-home are generated in output/build under the root of the source package; these are copied to catalina-home at the same level of the source package.
IDEA Import Project and configuration
1. Import the project
Start idea and import the project with import project. When you select the project, select the directory of the source code package, that is, apache-tomcat-8.5.32-src, and you can select it by default.
2. Configuration
After you successfully import the project, you must make a series of configurations to start the project successfully.
1) Click Run in the menu bar and select Edit Configurations in the drop-down box.
2) configure the following in the pop-up box that opens:
a. Click the green plus sign at the top left and select Apllication.
b. The name is random. At MainClass, enter: org.apache.catalina.startup.Bootstrap
C.VM options: enter the path of the catalina-home folder you just created, such as mine:
-Dcatalina.home= "D:\ Tomcat-Study\ catalina-home"
The version of Tomcat set in d.Use classpath of module and pom files is always consistent. If there is no consistency, the application cannot be created successfully. Generally, it automatically corresponds to the version set in the pom.xml file.
e. Confirm the jre, click apply, and the configuration is complete.
Start the project
Once configured, you can start the project. You can find the / java/org.apache.catalina.startup.Bootstrap.java file and inject the following output statement into the main function for observation.
Public static void main (String args []) {System.out.println ("Project start = ="); if (daemon = = null) {/ / Don't set daemon until init () has completed Bootstrap bootstrap = new Bootstrap (); try {.
Start the project. The console is displayed as follows:
Finally, the following message appears and no error is reported, which means that the project has been started successfully.
At this point, you can access it on browser. Enter localhost:8080, and the classic screen after Tomcat startup appears.
Then you can debug and develop the Tomcat source code.
The above is all the content of this article "how to create Tomcat8 source code for IDEA". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.