Build a Web development environment using IntelliJ IDEA and Maven Management (taking Spring MVC as an example)
I used MyEclipse all the time. After I changed my job, the new company used IDEA. I first got to know IDEA and found that wow, there are so many shortcut keys, but I think it is very useful all the way, especially with Maven management, it's a breeze. Of course, I have encountered many problems in the use process, but when we solve them all the way, you will feel that the world is so wonderful.
While searching for materials, I found that many netizens encountered many problems when using IDEA to build a web development environment (in fact, I also encountered many problems ), here is an example to illustrate how to use IDEA to build a Spring MVC Web project through maven management.
Development Environment:
Note: It is recommended that you modify the maven image to speed up maven download and use Alibaba images in China. Attached Alibaba image address:
<mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors
To build a spring web environment, follow these steps:
1. Open IDEA to create a Maven project, as shown in (Note: No Mavan prototype is selected here ).
2. Click Next to enter the Next interface, enter the desired name in the GroupId and ArtifactId fields, and click Next.
3. Enter the following interface and enter the project name.
4. Click Finish to create the project. The basic framework of the project is complete. The initial directory structure is as follows.
5. Configure Artifacts to lay the foundation for tomcat configuration. Click the Project Structure button.
6. In the Project Structure dialog box, click the Artifacts option.
7. After performing the preceding three steps, the following interface is displayed. Here we enter a name for Artifacts. The specific operation is shown in.
Note: Check the Bulid on make option in step 1 of the change chart to prevent non-compilation errors. It is important in step 2. When we are preparing to release a project, right click here, click Put into Output Root to release the project. Make sure there are no problems (key points)
8. Go to the Project Structure page and click the Facets option, as shown in.
9. In the displayed dialog box, perform the following operations.
10. Click Apply on the following page.
11. The project directory is shown in (note the added content ).
12. Rename the web directory to webapp and move it to the src \ main directory. The modified project directory is shown in.
13. Return to the Project Structure interface and click the Facets option to modify the web resource directory (because we modified and moved the web directory in the previous step), as shown in.
After the preceding steps, modify the value of Web Resource Directory to the Directory of the current webapp.
14. Configure the Tomcat container. First, perform the following operations.
15. perform the following operations in the dialog box.
16. Perform tomcat configuration.
17. After completing the four steps above, the following results are displayed.
In the Deploy at the server startup column, that is, the Artifacts we just created. Then, in the Application context, you can create a name for the web project, which is myweb.
18. On this page, click the Server bar and configure the following two items so that the modification of some files takes effect immediately (such as jsp ).
Now that the basic web environment has been set up successfully, configure Spring MVC through Maven.
For more details, please continue to read the highlights on the next page: