How eclipse imports Maven project (beginner)

Recently, I met the spring MVC project under Maven's management. A member of the team threw the project code over and looked confused (Dan Qiao and Mu Mu were confused about the project, so I recorded it and shared it with you.

Generally speaking, Maven is a project management tool similar to GIT. Spring MVC is to separate m (model), V (view) and C (controller), which is more conducive to development. Next, I will introduce a maven project compiled by others to you how to import it into the integrated development environment.

Development environment: Eclipse

Step1:

In eclipse, select File - > import; Next, as shown in the figure below:

Click browse, select the folder where the project is located, and then finish to add the project.

Step2:

Convert the imported Maven project into a dynamic web module, and check the red box in the figure below;

Step 3: add Maven dependencies

Right click the project - > properties - > deployment assembly, as shown in the red box in the figure. There are only four folders under SRC:

Click add, as shown in the figure:

From the above three steps, the imported Maven project will be transformed into a running web project.

Then create a new web server. Tomcat needs to be installed and integrated into eclipse, so that you can create a web server. After creating a web server, right-click the imported project, select "run as" and select run on server Right click item - > run on server.

Tips:

(1) Your own development environment eclipse should be configured correctly with tomcat, and the version of Tomcat should be consistent with the previous version.

(2) If you run run on server, the Tomcat startup console reports an error: "serious error: Java lang. classnotfound" (I can't remember clearly, it should be), indicating that your Maven dependencies have not been added.

Eclipse Maven imports parent and child modules

Many times, a large Maven module contains many small Maven modules. At this time, if we import large Maven modules first and then import their sub modules one by one, it will be more troublesome. Here is a method to quickly import all Maven modules.

1. Import the main Maven module 2 Delete the project from eclipse, but do not choose to delete from the hard disk. 3. Re import the deleted module in the form of local project

In this way, Maven will automatically download all other child modules contained in the parent module according to the module dependency.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>