pom.xml报错web.xml is missing and is set to true

原文链接: https://www.cnblogs.com/suziyu/p/11048360.html

一、web.xml is missing and <failOnMissingWebXml> is set to true

  原因是在项目中缺少web.xml,且<failOnMissingWebXml>被设置成了true

  解决方法:a.如果项目需要web.xml,去复制一个web.xml到项目中即可。

          也可以使用Eclipse生成:有如下两种方式

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

          2.右击项目——>Properties——>Project Facets  将Dynamic Web Module的勾去掉,点击Apply,再重新勾上,点击下方出现的Further configuration availber,再选择生成的目录即可生成web.xml

如果项目不需要web.xml,则需要在pom.xml中将<failOnMissingWebXml>配置成false,有如下两种配置方式

1、

<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>

2、

<properties>
    <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>

猜你喜欢

转载自blog.csdn.net/qq262593421/article/details/99055501
今日推荐