IDEA2022 version creates maven web project (two ways) the most complete graphic teaching

IDEA2022 version creates maven web project

Time of problem occurrence: 2022.1.3
Problem description: Many people are puzzled by the new version of idea2022 that there is no web folder after creating a project, which makes it difficult to create a project

提示:环境搭建的过程中请注意细节问题,避免粗心大意导致的错误

1. Use the skeleton method

1. The structure created by the skeleton in the idea?

The skeleton can create a project structure for us more quickly, and idea provides us with a lot of skeleton templates, so everyone still doesn't understand it. In layman's terms, it can be used to generate projects faster. The following is the web project structure using the skeleton:
insert image description here
After using the skeleton, we still found that there is still something short of a complete project structure: the missing directory structure of the Maven Web project, there is no The java and resources directories need to be created and filled manually. Let me show you my final completed project structure:
insert image description here
look down to see the specific creation steps

2. Use the skeleton method steps

  • 1. Create a Maven project and give the project a good name

insert image description here

  • 2. Select the jdk version you downloaded

insert image description here

  • 3. Choose to use the Web project skeleton

insert image description here

  • 4. Confirm Maven-related configuration information

insert image description here

  • 5. Complete project creation

insert image description here

  • 6. Delete the redundant content in pom.xml, leaving only the following content, pay attention to the difference between the packaging method jar and war

insert image description here

  • 7. The directory results are as follows:

insert image description here

  • 8. Complete the missing directory structure of the Maven Web project, there are no java and resources directories by default

insert image description here

  • 9. You need to manually complete the creation and completion

insert image description here

  • 10. Created successfully

insert image description here

2. The way of not using the skeleton

1. Do not select the structure created by the skeleton?

I personally recommend using the creation method without a skeleton.
insert image description here
The skeletonless creation method also requires some steps to complete. It is just that the above picture has not completed a complete project creation. The following picture is the project structure I successfully created after the operation: Everyone, go
insert image description here
down You can see the detailed steps to complete the creation.

2. Not using the skeleton step

  • 1. Create a Maven project

insert image description here

  • 2. Choose not to use the web project skeleton, choose the local jdk

insert image description here

  • 3. Complete the creation of the project

insert image description here

  • 4. Set the packaging method to war in pom.xml

insert image description here
insert image description here

  • 5. Complete the directory structure of the missing webapp in the Maven Web project

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

  • 6. After supplementing, adjust the project structure. The final project structure is as follows:

insert image description here
So far we have completed the skeletonless creation. Everyone must pay attention to some prompts when creating, and it is easy to make mistakes!

3. Summary

There are two ways to create a web project with Maven: using a skeleton and using a skeleton without using
a skeleton

The specific steps include:
1. Create a Maven project, give the project a good name
2. Select the jdk version you downloaded
3. Choose to use the Web project skeleton 4.
Confirm Maven-related configuration information
5. Complete the project creation
6. Delete pom.xml In the redundant content, only the above content is left, pay attention to the difference between jar and war packaging methods
7. Fill in the missing directory structure of the Maven Web project, there is no java and resources directory by default

no skeleton

The specific steps include:

1. Create a Maven project
2. Choose not to use the web project skeleton, choose the local jdk
3. Complete the project creation
4. Set the packaging method in pom.xml to war
5. Complete the missing webapp directory structure of the Maven Web project
6. Supplement After finishing, adjust the project structure

  • I hope my post can help more people, code words are not easy, please give me a like~ Your support makes me more motivated
  • I wish you all the best in the new year!

Guess you like

Origin blog.csdn.net/weixin_45384457/article/details/128532296