Maven项目pom.xml文件报错“web.xml is missing and is set to true”

  解决方案引用自:web.xml is missing and <failOnMissingWebXml> is set to trueweb


  最近作的一个maven管理的web项目,遇到项目中pom.xml文件报“web.xml is missing and <failOnMissingWebXml> is set to   true”的错误,错误缘由是项目中没有web.xml文件:
apache

wKioL1keUNuB1DzPAABNXDIX-uY271.png-wh_50

  经查询找到3个解决方案:app

一、生成 web.xml 文件(若是确实不须要web.xml文件,建议跳过此方案,以保持项目代码的干净)webapp

  • 在 Project Explorer 视图窗口右击项目的“Deployment Descriptor”项;maven

  • 选择“Generate Deployment Descriptor Stub”;ide

  • 而后就在“src/main/webapp/WEB-INF”目录下建立web.xml文件ui

wKiom1keVT6AQNYcAABotpxeqPw250.png-wh_50

二、在 pom.xml 文件中加入以下配置:
spa

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

三、在 pom.xml 文件中加入以下配置(短配置,与版本无关):
orm

<properties>
    <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
相关文章
相关标签/搜索