创建Maven web项目时 出现 web.xml is missing and <failOnMissingWebXml> is set to true错误 pox.xml编译错误

xiaoxiao2021-02-28  119

创建Maven web项目时 出现 web.xml is missing and is set to true错误 pox.xml编译错误链接

今天创建一个maven项目 pom.xml出现如下错误:

web.xml is missing and is set to true

这是因为你因为你WEB-INF下没有web.xml导致造成的

解决方案:

右击项目——>Java EE Tools——>Generate Deployment Descriptor Stub.然后系统会在src/main/webapp/WEB_INF文件加下创建web.xml文件。错误解决!

当然这个方法是针对web项目的解决方案,如果你的工程不是web项目,那么还有另外一种解决方案,就是在pom文件中配置一下failOnMissingWebXml。具体配置如下:

<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>
转载请注明原文地址: https://www.6miu.com/read-41839.html

最新回复(0)