zoukankan      html  css  js  c++  java
  • 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还没有跟上这一变化。
    我们只要在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使其重新编译,重新下载后正常。
     
  • 相关阅读:
    c# where(泛型类型约束)
    jQuery自定义插件
    jQuery插件定义
    SQL中merge into用法
    .net framework 4.5安装失败
    jQuery操作Form表单元素
    在WebAPI使用Session
    大数据量数据库设计与优化方案(SQL优化)
    修改NUGET包默认存放位置
    C#知识体系(一) 常用的LInq 与lambda表达式
  • 原文地址:https://www.cnblogs.com/xyhero/p/47d18f25adf3cfda21fc5bf2cf8e82f7.html
Copyright © 2011-2022 走看看