您的位置:首页 > 产品设计 > UI/UE

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

2017-05-19 10:22 706 查看
  解决方案引用自:web.xml is missing and <failOnMissingWebXml> is set to true

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



  经查询找到3个解决方案:
1、生成 web.xml 文件(如果确实不需要web.xml文件,建议跳过此方案,以保持项目代码的干净)
Project Explorer 视图窗口右击项目的“Deployment Descriptor”项;

选择“Generate Deployment Descriptor Stub”;

然后就在“src/main/webapp/WEB-INF”目录下创建web.xml文件



2、在 pom.xml 文件中加入如下配置:

<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>
3、在 pom.xml 文件中加入如下配置(短配置,与版本无关):

<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐