新建maven工程后,pom文件报错:web.xml is missing and <failOnMissingWebXml> is set to true,是因为在webapp下没有找到web.xml 导致的。
解决方法1:手动创建web.xml在 src/main/webapp 下
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>test</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app>
解决方法2:如果使用的eclipse ,可以右击项目, 选择java EE tools -> Gen...
自动生成。