新建MAVEN项目没有web.xml问题

新建MAVEN项目没有web.xml问题

刚刚新建的maven项目就报错

在这里插入图片描述

错误是:web.xml is missing and is set to true 说明刚刚新建的maven项目没有web.xml,所以报错。

解决办法如下:

先右键选择项目 —>Properties

在这里插入图片描述

选择Project Facets —>先把 Dynamic Web Module 2.5 的勾去掉,然后点击 Apply

在这里插入图片描述

下一步再把刚才去掉的勾在选中 Dynamic Web Module ,在勾上,会出现 Further Configuration available…,然后点击 Further Configuration available…

在这里插入图片描述

在Content directory中输入 src/main/webapp (web.xml存放路径) 然后点击 OK ----> 在点击 Apply and Close

在这里插入图片描述

这个时候web.xml就会出现在我们刚才设定的路径下面了 pom.xml也就不会报错了。

猜你喜欢

转载自blog.csdn.net/map_cx/article/details/89307407