maven项目提示web.xml is missing或红色感叹号
Posted 架构师小跟班
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven项目提示web.xml is missing或红色感叹号相关的知识,希望对你有一定的参考价值。
1、web.xml is missing and <failOnMissingWebXml> is set to true 提示信息应该能看懂。也就是缺少了web.xml文件,<failOnMissingWebXml>被设置成true了。
目前被顶次数最多的回答原文如下:
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 <packaging>war</packaging>. 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还没有跟上这一变化。
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 <packaging>war</packaging>. 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文件中手动添加如下配置:
<properties> <failOnMissingWebXml>false</failOnMissingWebXml> </properties>
2、红色感叹号,build path无报错
一般是因为缺少jar包。在保证pom.xml没有报错的情况下,顺序进行如下操作。
1)项目右键,maven download sources
2)项目右键,maven update project
3)项目右键,run as maven clean
4)project clean 选中报错项目 clean
如果以上步骤仍然无效,可在Problems视图查看具体错误,
Description Resource Path Location Type
Archive for required library: ‘D:/DevTools/mavenrepo/org/apache/lucene/lucene-backward-codecs/5.5.4/lucene-backward-codecs-5.5.4.jar‘ in project ‘test‘ cannot be read or is not a valid ZIP file test Build path Build Path Problem
在Maven仓库中查看,发现该jar包已存在,删除之,随便修改pom.xml使其重新编译,重新下载后正常。
以上是关于maven项目提示web.xml is missing或红色感叹号的主要内容,如果未能解决你的问题,请参考以下文章
Spring boot 打包为war包报错:提示缺少web.xml
[转]在Eclipse整合Maven3.6.3插件导入maven项目并编译时,控制台提示No compiler is provided in this environment. Perhaps you