pom配置第一行报错MavenArchiver.getManifest或者web.xml is missing and <failOnMissingWebXml> is set to true

今天搭建springboot环境发现第一行报org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration)

和web.xml is missing and <failOnMissingWebXml> is set to true ,下面的配置可以解决这两个问题。

 

一、web.xml is missing and <failOnMissingWebXml> is set to true

  原因是在项目中缺少web.xml,且<failOnMissingWebXml>被设置成了true

  解决方法:a.如果项目需要web.xml,去复制一个web.xml到项目中即可。

          也可以使用Eclipse生成:有如下两种方式

                    1.右击项目——>Java EE Tools——>Generate Deployment Descriptor Stub.然后系统会在src/main/webapp/WEB_INF文件加下创建web.xml文件。错误解决!

          2.右击项目——>Properties——>Project Facets  将Dynamic Web Module的勾去掉,点击Apply,再重新勾上,点击下方出现的Further configuration availber,再选择生成的目录即可生成web.xml

        

         

 

      b.如果项目不需要web.xml,则需要在pom.xml中将<failOnMissingWebXml>配置成false,有如下两种配置方式

      1.

复制代码
<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>
posted @ 2020-02-19 17:19  cuker919  阅读(221)  评论(0)    收藏  举报