這時候需要右擊項目——>Java EE Tools——>Generate Deployment Descriptor Stub.然後系統會在src/main/webapp/WEB_INF文件加下創建web.xml文件。錯誤解決!
當然這個方法是針對web項目的解決方案,如果你的工程不是web項目,那麼還有另外一種解決方案,就是在pom文件中配置一下failOnMissingWebXml。具體配置如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | < build > < plugins > < plugin > < groupId >org.apache.maven.plugins</ groupId > < artifactId >maven-war-plugin</ artifactId > < version >2.6</ version > < configuration > < failOnMissingWebXml >false</ failOnMissingWebXml > </ configuration > </ plugin > </ plugins > </ build > |