Three ways for IDEA to create Maven Web projects
The first way: using a skeleton
Create steps:
1. Open File—>Project Structure—>New Maven Module
2. Set your own Maven path, click Finish, and idea will automatically configure and download the corresponding plug-ins
3. After the download is complete, the creation of the Maven Web project is basically completed
In the pom.xml file, there will be dependencies and downloaded plug-ins automatically configured by IDEA
We found that the packaging method is a war package, not a jar package. The default configuration of IDEA is a jar package, indicating that the Maven Web project we configured has been completed. Open the Facets corresponding to the Project Structure, and the Web project has been created.
Module directory structure
This is to find that the project is incomplete, without the Java folder and the resources resource folder, let's create it now.
Creation means that IDEA automatically prompts us for the folder to be created, click Create, and the Maven Web project is created.
The second way: without using a skeleton
1. Open File—>Project Structure—>New Module (do not check here)—>Create directly
At this time, the Maven project is created, but it is not a Web project, we need to manually change it to a Web project
2. Open the pom.xml configuration file, add this line of code, and change the packaging method from jar package to war package
<packaging>war</packaging>
3. Open Project Structure—> find Facets, click the + sign to create a new Web project
IDEA will automatically create the web directory and web.xml configuration file for us. In the project, rename the web webapp and move it to the main folder.
If the versions are inconsistent, the system does not automatically configure the webapp directory
It will become popular automatically, just double-click the directory to create it, and add the web.xml configuration file to complete the creation
The third way: use the JBLJavaToWeb plug-in
1. Open File—>Settings—>Plugins option—>Search JBLJavaToWeb plug-in to download and install
2. Right-click on the module selection option as shown in the figure below
click settings
After filling in the setting plug-in, the corresponding web directory and configuration file are automatically configured, and the Maven web project is created