.personSunflowerP { background: rgba(51, 153, 0, 0.66); border-bottom: 1px solid rgba(0, 102, 0, 1); border-top-left-radius: 7px; border-top-right-radius: 7px; color: rgba(255, 255, 255, 1); height: 1.8em; line-height: 1.8em; padding: 5px }

问题描述:有时候新建的maven工程后,项目的pom.xml中报错:web.xml is missing and <failOnMissingWebXml> is set to true

如图:

解决分两种情况(三种解决方法):

1.若项目中不需要web.xml文件,且不是Web工程,则直接在pom.xml文件中加入以下配置,然后update一下项目:

  <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.项目是Web工程,则需要web.xml文件(两种解决方案)

  1)最简单最直接的是在src/main/webapp/下新建WEB-INF/web.xml(也可以从其他项目中拷贝一个web.xml过来),如下图。然后刷新项目:

  2)最可靠的是让项目自动 WEB-INF/web.xml生成。操作步骤如下:

    ①右击项目,然后点击Properties-->Project Facets,将在右侧Dynamic Web Module选中项去除,再点击Apply(应用)。

    

    ②然后重新勾选Dynamic Web Module,点击下方的Further configuration available... 在弹出的窗口中配置Content directory的值填入:src/main/webapp,点击ok ,再点击Appy --> Apply and Close.刷新工程即可。如下图:

    

    ③完成后,自动生成的结构如下图,非常完整:

  若过程中还有其他问题,欢迎留言一起解决。

pom.xml中web.xml is missing and <failOnMissingWebXml> is set to true错误的解决的更多相关文章

  1. 解决Eclipse里的Maven工程pom.xml文件报:web.xml is missing and <failOnMissingWebXml> is set to true错误

    打开eclipse准备进行开发时,发现项目上有个红星号,查看错误后发现报了一个:"web.xml is missing and <failOnMissingWebXml> is ...

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

    今天创建一个maven项目 pom.xml出现如下错误: web.xml is missing and <failOnMissingWebXml> is set to true 这是因为你 ...

  3. web.xml is missing and <failOnMissingWebXml> is set to true 错误解决办法

    对web项目的解决方案: 右击项目——>Java EE Tools——>Generate Deployment Descriptor Stub. 然后系统会在src/main/webapp ...

  4. 创建Maven项目时提示web.xml is missing and <failOnMissingWebXml> is set to true错误解决方案

    1. 右键点击Deployment Descriptor 2. 选择Generate Deployment Descriptor Stub P.S.下面顺便提一个小技巧: 创建动态web时先右键项目, ...

  5. 【maven】maven创建web项目-pom文件提示web.xml is missing and <failOnMissingWebXml> is set to true

    使用maven创建web项目,选择war类型后,pom文件红叉 提示web.xml is missing and <failOnMissingWebXml> is set to true ...

  6. pom.xml出现web.xml is missing and <failOnMissingWebXml> is set to true解决方案

    提示信息应该能看懂.也就是缺少了web.xml文件,<failOnMissingWebXml>被设置成true了. 搜索了一下,Stack Overflow上的答案解决了问题,分享一下. ...

  7. 解决maven项目中web.xml is missing and <failOnMissingWebXml> is set to true

    web.xml is missing and <failOnMissingWebXml> is set to true 是因为项目中没有web.xml文件, 步骤如下:

  8. maven的pom报错web.xml is missing and <failOnMissingWebXml> is set to true

    错误信息:web.xml is missing and <failOnMissingWebXml> is set to true 解决办法:https://blog.csdn.net/si ...

  9. 解决 web.xml is missing and <failOnMissingWebXml> is set to true 报错

    在学习maven模块化构建项目的时候遇到了如下报错信息: web.xml is missing and <failOnMissingWebXml> is set to true. 这时候需 ...

随机推荐

  1. SpringBoot | 1.2 全注解下的Spring IoC

    前言 在学习SpringBoot之前,有几个Spring的重要的基础概念需要提一下,SpringBoot对这些基础概念做进一步的封装,完成自动配置.首先就是Spring的控制反转IOC,由于Sprin ...

  2. Docker:Docker的Run命令使用时报错

    命令报错:WARNING: Your kernel does not support swap limit capabilities, memory limited without swap. 这是因 ...

  3. 10 shell test命令

    0.test命令的用法 1.与数值比较相关的test选项 2.与字符串判断相关的 test 选项 3.与文件检测相关的test选项 4.与逻辑运算相关的test选项 5.注意点与总结 1.test中变 ...

  4. PHP实现的解汉诺塔问题算法示例

    问题描述: 相传在古印度圣庙中,有一种被称为汉诺塔(Hanoi)的游戏.该游戏是在一块铜板装置上,有三根杆(编号A.B.C),在A杆自下而上.由大到小按顺序放置64个金盘(如下图).游戏的目标:把A杆 ...

  5. Xshell怎么连接数据库

    之前一直用Navicat Premium链接数据库,其实在xshell也可以链接数据库,本文将先介绍如何用xshell链接数据库的方法. 1.打开xshell,连接上 输入指令:mysql -h 19 ...

  6. Macbook(M1版)的用户看过来,.net 6 Preview 6支持Apple Silicon for macOS

    本文由葡萄城技术团队翻译 转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者. 我们很高兴发布.NET6预览的第6版,本次预览是倒数第二次预览了.在本次预览发布之 ...

  7. 「AGC021E」Ball Eat Chameleons

    「AGC021E」Ball Eat Chameleons 考虑如何判定一个合法的颜色序列. 不妨设颜色序列中有 \(R\) 个红球,\(B\) 个蓝球,所以有 \(R+B=k\). 考虑分情况讨论: ...

  8. python根据正则表达式生成指定规律的网址

    import os def file_name(file_dir): for root, dirs, files in os.walk(file_dir): print(root) #当前目录路径 p ...

  9. 家庭账本开发day07

    返回数据问题解决,需要按照规定的json数据进行返回. 利用jsonobejact或者GSON工具将对象ArrayList转化为json 格式.然后response.getWriter().write ...

  10. 自动执行文件夹中的py文件

    写一个函数,接收一个地址,执行其中的py文件,包括子文件.path.endswith('.py') 判断以'.py'结尾,是什么类型的文件.os.system('python %s'%path) 模拟 ...