pom.xml出现web.xml is missing and <failOnMissingWebXml> is set to true解决方案
来源:互联网 发布:加工中心半圆怎么编程 编辑:程序博客网 时间:2024/06/08 14:51
提示信息应该能看懂。也就是缺少了web.xml文件,被设置成true了。
搜索了一下,Stack Overflow上的答案解决了问题,分享一下。
目前被顶次数最多的回答原文如下:
This is a maven error. It says that it is expecting a web.xml file in your project because it is a web application, as indicated by war. However, for recent web applications a web.xml file is totally optional. Maven needs to catch up to this convention. Add this to your maven pom.xml to let maven catch up and you don’t need to add a useless web.xml to your project:
大意是说这是一个Maven错误,在最近的web应用开发中web.xml文件已经变得可有可无了。不过Maven还没有跟上这一变化,我们只要在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>
“告知”maven即可。这样做的好处是我们不必在项目生中成一个无用的web.xml文件。在更新版本(具体从哪一个版本开始我也不知道~~)的maven中已经不存在web.xml文件缺失的问题,我们只需要处理被设置成tue的问题即可。也就是在pom.xml中添加如下配置即可。
<properties><failOnMissingWebXml>false</failOnMissingWebXml></properties>
其他方案:(生成web.xml——>部署运行时文件路径)
you can do it also like this:
Right click on Deployment Descriptor in Project Explorer.
Select Generate Deployment Descriptor Stub.
It will generate WEB-INF folder in src/main/webapp and an web.xml in it.
这是被采纳方案,也就是说在项目浏览器中右键单击Deloyment Descriptor,选择生成部署描述符存根:Generate Deployment Descriptor Stub。
操作后会在项目的src/main/webapp/WEB-INF目录下生成web.xml文件。我按照这个方法生成了web.xml文件,但是仍然报错。如果你也是的话可以接着往下看。
Here are the steps you can follow:
You can check this by right clicking your project, and open its Properties dialogue, and then “Deployment Assembly”, where you can add Folder /src/main/webapp. Save the setting, and then,
Go to Eclipse menu Project -> Clean… and clean the project, and the error should go away.
此时需要对src/main/webapp文件进行运行时的路径部署,以保证服务器正常运行。
也就是说需要部署一下src/main/webapp(刚生成的web.xml就在该文件夹下)文件夹,Deployment的作用是会在运行时将相应的resource复制到web服务器的相应目录下(通过Deploy Path指定),保证web应用正常运行。
经过这两步,问题解决。
- pom.xml出现web.xml is missing and <failOnMissingWebXml> is set to true解决方案
- pom.xml出现web.xml is missing and <failOnMissingWebXml> is set to true解决方案
- maven 的pom出现web.xml is missing and <failOnMissingWebXml> is set to true
- maven 的pom.xml 配置异常web.xml is missing and <failOnMissingWebXml> is set to true
- pom.xml报错:web.xml is missing and <failOnMissingWebXml> is set to true
- Maven中pom.xml报错:web.xml is missing and <failOnMissingWebXml> is set to true
- pom.xml报错:web.xml is missing and <failOnMissingWebXml> is set to true
- pom.xml项目文件中出现web.xml is missing and <failOnMissingWebXml> is set to true解决方法
- web.xml is missing and <failOnMissingWebXml> is set to true
- web.xml is missing and <failOnMissingWebXml> is set to true
- web.xml is missing and <failOnMissingWebXml> is set to true
- web.xml is missing and <failOnMissingWebXml> is set to true
- web.xml is missing and <failOnMissingWebXml> is set to true
- web.xml is missing and <failOnMissingWebXml> is set to true
- web.xml is missing and <failOnMissingWebXml> is set to true
- web.xml is missing and <failOnMissingWebXml> is set to true
- web.xml is missing and <failOnMissingWebXml> is set to true
- web.xml is missing and <failOnMissingWebXml> is set to true
- MSP430学习笔记-定时器A
- 小知识点集合
- H5 CSS3 实现文字图片同行居中
- tf_3_Variable
- 什么是NIST加密标准?
- pom.xml出现web.xml is missing and <failOnMissingWebXml> is set to true解决方案
- 从JDK源码看字节流和字符流
- 【大数据】数学基础及应用
- Android图片添加阴影效果的两种方式
- 利用sftp进行远程ssh的上传下载
- es6快速入门(1)--字符串的扩展
- 自定义分页
- vscode bug
- 今日头条TabLayout+Fragment