Table of contents
Additional knowledge: IDEA configures tomcat
Preface must read
There are two ways to create a maven web project, one is to use the skeleton method, the other is not to use the skeleton method
Creation method
1. How to use the skeleton
1. Open idea and follow the steps to create a new project
2. Click Maven Archetype (skeleton), customize the project name, select this web skeleton, and click Create
3. Under construction
PS: This generally takes a long time (because there is a wall, and the central warehouse of maven is abroad), it will be stuck in [INFO] Generating project in Batch mode for a long time, you can choose
1. Close Recreate
2. Be patient
3. Or go to (the location where maven is installed on the local disk--conf package--settings.xml to configure the Aliyun warehouse-this is taught in my other articles )
4. This is the build success:
5. Delete the redundant plug-ins in pom.xml, delete from the war down to the remaining one</project>
Results:
6. Right-click main-->New-->Directory
7. Complete the two directories according to the prompts (just add them twice)
Result: This completes successfully
8. Add a complete test package. Right click on src --> New --> Directory
9. According to the prompt, select the Enter key to complete the two directories.
Final result display
In this way, the skeleton maven web project is established
2. Add web mode in maven
1. This is the creation method of maven (hyperlink)
2. Add the following to pom.xml in this maven project
<packaging>war</packaging>
Then there is a refresh in the upper right corner, remember to refresh
Results:
3. Double-click java in the project
4. Just follow the steps in the picture, and click OK on the pop-up windows that appear
5. Just follow the steps in the picture
Just click OK in the pop-up window, and then click OK on the entire page.
6. Use the mouse to drag this WEB-INF into the webapp.
When dragging, a page will pop up, just click Refactor
Results:
In this way, the maven project created step by step without the skeleton is created
Additional knowledge: IDEA configures tomcat
If you want to run the project in the maven project, you need to configure tomcat
IDEA configures and deploys tomcat detailed steps (maven web and Javaweb) - Programmer Sought
Summarize:
The two creations are the same. If the first skeleton loads quickly, I still like to use the first method. If the skeleton loads slowly, you can use the second step-by-step creation method.
If you think this article is helpful to you, please give it a one-click triple link ! ! !
Like, follow and collect , fist up!