Eclipse Maven project

I am also a novice white, when creating the Maven project almost stepped on all over the pit. Hereby summarized as follows:

1, we first select File -> New -> Maven Project

2, then as shown below

  

 

Explain here Group Id generally domain name upside down, Aritifact Id is the name of your project.

 

3, there will be project structure after you click Finish, we right-click on the project name Properties, as shown below:

 

 

 At this point, we canceled Dynamic Web Module option and Java JDK version that is transferred to 11, 11 because the JDK is the latest and most stable version.

Click Apply, then check the Dynamic Web Module version and jump to 4.0, 4.0 is the latest version at this time. The results shown below:

I do not rush Apply, click on the link below Further ...: Check Generate web.xml, and then click OK. And then look to Apply and Close up.

 

4, is something else, at this time we not make things right directory structure:

 

We need to add java directory to the main, the added resources and test in the directory.

We are still right project name, then click the Build Path -> Configure Build Path ... after the figure below

 

 

 Here we click Add Folder ..., then as shown below:

 

 After clicking Next -> Finish, then click OK.

 

5, we double-click Contains test sources: NO so that it becomes Yes, then double-click Output folder, as shown, and then click OK, then Apply and Close.

 

 

6, project structure shown in FIG becomes the following:

 

 

7, finally: if we want to root directory is set to webapp, it is still the right project name, click Propertites. as the picture shows:

 

We chose this / WebContent, then click Remove, and then click Add 

 

选中 Folder 后点击 Next,然后如图所示:选中 webapp 后 Finish,再 Apply and Close。

 

 

 8、最后把项目添加到 Tomcat 中运行:

 

Guess you like

Origin www.cnblogs.com/M-Anonymous/p/11616509.html