Jetty source code learning-compiling Jetty source code two or three things, source code compilation jetty

Source: Internet
Author: User

Jetty source code learning-compiling Jetty source code two or three things, source code compilation jetty

I have been working for a few months. I have learned about JDK basics and web application frameworks. I started to learn Jetty source code. It took me half a day to compile the code and record the pitfalls I have split.

Environment before Compilation:

MAVEN 3.3, Eclips eLuna Service Release 1 (4.4.1)

After downloading MAVEN, you must configure maven in Eclipse as the MAVEN to be downloaded. For details, please search for other blog posts for reference!

 

1. Download source code

1.1 Jetty source code can be easily downloaded on the Jetty project homepage of Github.

1.2 after you enter the home page, you can see the following pages:

1.3 click 1 on the Jetty project homepage to display a drop-down menu. You can press branch or tag to select different Jetty versions. This article uses Jetty 9.3.x, which is the snapshot version.

1.4 click 2 on the Jetty project homepage to show how to download the source code package. If you do not have a git client or do not want to install it, click the link to download the zip package for direct download.

 

 

2. Import eclipse

2.1 After downloading the zip package, decompress the package. The files in the root directory of the jetty package are listed below. Here, the directory is described as $ myJettySourceRoot.

Two files in the Red Circle in this directory (later called $ myJettySourceRoot) are worth noting:

README. md is the prompt content provided by the developer team for developers who compile the source code, but do not take it seriously! The compilation won't be successful if it is fully done by him !!!

Porm. xml is the root porm file of the Jetty project.

2.2 Open Eclipse and choose File> import> Maven> Exesting Maven Projects. Select the $ myJettySourceRoot Directory, which is C: \ Users \ Administrator \ Downloads \ jetty. project-jetty-9.3.x, for example, select all projects. Click "finish" to start importing, and Maven will start

The project may take three hours to download the dependency package. For all options that appear in the middle, click "Confirm" and "resolve later". The options for restarting Eclipse may also be "Confirm ".

3. Compile the source code

3.1 after the import is successful, the directory tree in Eclipse is as follows. Right-click the Jetty-Protject project and choose run as> Maven clean to clean the project.

3.2 after cleaning, right-click the etty-Protject project and choose run as> run configuration. Create a build configuration under Maven Bulid. Install by configuration, but skip test. (Because some tests are difficult to succeed on the local machine ). Click "run" to start compilation,A failure may occur in the middle of the process. For the processing steps, refer to 3.3. After repeated times, the compilation is successful..

3.3 references for handling compilation failures.

During compilation, compilation often fails. You can view the console information and find"Could not resolve dependencies for Similar information of xxx: jar: test. In this case, a submodule of jetty-project depends on the test package of another submodule. In this case, find the Maven project corresponding to xxx in Eclipse, right-click run as-> maven install. For example, if xxx is jetty-plus, right-click the jetty-plus project and run as-> maven install. run 3.2 according to all the packages of this sub-module, repeat several times to compile successfully. Complete Compilation successful, for example:

3.4 In the $ myJettySourceRoot \ jetty-distribution \ target \ distribution directory (my directory is C: \ Users \ Administrator \ Downloads \ jetty. project-jetty-9.3.x \ jetty-distribution \ target \ distribution) can be found after the successful compilation of the found file.

3.5 Open cmd, cd to this directory, and enter java-jar start. jar to start Jetty.

 

 

 

 

 

 

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.