1.
2.
3.
4.
5.
这种错误是因为maven默认简单构建项目是sevlet3.0版本,web.xml不是必须的,这时候需要手动创建webapp/WEB-INF
/web.xml,web.xml可以从其他项目复制一个过来改改, 或者pom.xml添加如下配置。
最后修改完了别忘了右键项目Mavan/update project..
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
参考:http://blog.youkuaiyun.com/u010697681/article/details/50761184
6.亲测有效
本文介绍了解决Maven项目中因缺少web.xml文件而导致的问题的方法。通过手动创建或从其他项目复制web.xml文件,并调整pom.xml配置禁用构建时的web.xml缺失检查。

被折叠的 条评论
为什么被折叠?



