Regarding the maven project, the solution to the problem of automatically generating the web.xml file

Recently, when I was learning Shiro framework to integrate into web projects, I created a new maven project and found that the web.xml file data under webapp could not be automatically generated.

I have reviewed many materials on the Internet, and the author summarized two methods.

Note: If you don’t install the plug-in, the following two methods cannot be implemented, because you can’t find the corresponding button or tab at all. The author has an article dealing with this issue ( Eclipse can’t find Java EE Tools tab problem solution ) for your reference!

Solution 1: Can be automatically generated according to Java EE Tools

Select the maven project-->right click-->Java EE Tools-->Generate Deployment Descriptor Stub

The web.xml file is automatically generated

 

 

Option 2: You can add according to the Project Facets of the project properties

Right click on the project --> Properties -->Project Facets --> select Dynamic Web Module

The above two schemes can achieve the effect of generating web.xml files

 

Of course, you can also create it manually, but I believe you all have a deep understanding of the consequences of manual creation! Various problems are difficult to troubleshoot. Since tools can help us, why not use it directly...

Guess you like

Origin blog.csdn.net/dgxin_605/article/details/88776683