1. Create a parent project
1. Create Project
2. Turn on the automatic import function (IDEA2020 cancels this setting)
- Method 1: shortcut key method
Use Ctrl + Shift + O to automatically import maven dependencies. - Method 2: Click on the icon. Every time a new dependency is added, there will be a small M icon in the upper right corner of pom.xml. Click to load Maven changes.
3. Configure Maven information
2. Create a JAVA module project
Add junit dependency
test:
- Create a new Java file in main
- Create a new test file in test and run it successfully
3. Create a web module project
1. Follow the steps to create a java module to complete the creation.
2. Modify the packaging method
3. Web settings
Note that you need to add src/main to the directory
to set the root directory of the web resource
to generate the web directory:
Note: You can also add the web directory through Add Frameworks Support:
but the generated web directory is not under the main, you need to manually set it:
first pull the web directory directly under the main, and then set the root directory:
4. Create a new Tomcat connection
The browser appears:
The point is to set the root directory of the web! ! ! !
Flowers are over!