为什么点“[INFO] WEB-INF/web.xml 已经添加,跳过";何时使用 maven 打包(战争)项目? [英] Why point "[INFO] WEB-INF/web.xml already added, skipping" when packaging(war) the project using maven?

查看:58
本文介绍了为什么点“[INFO] WEB-INF/web.xml 已经添加,跳过";何时使用 maven 打包(战争)项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用maven打包项目时,maven-war-plugin:war目标有如下信息.

When packaging the project using maven, the maven-war-plugin:war goal has the following information.

[INFO] Packaging webapp
[INFO] Assembling webapp [xxx] in [/Users/zhangna13/Workspace/xxx/xxx/target/xxx-release-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/zhangna13/Workspace/xxx/xxx/src/main/webapp]
[INFO] Webapp assembled in [2230 msecs]
[INFO] Building war: /Users/zhangna13/Workspace/xxx/xxx/target/xxx-release-1.0-SNAPSHOT.war
[INFO] WEB-INF/web.xml already added, skipping

我在目标目录中找到了 web.xml,但为什么存在 2 个 web.xml 文件?

I find the web.xml in the target directory, but why 2 web.xml files exist?

推荐答案

要摆脱警告,您必须将不直观的配置参数 添加到 的配置中maven-war-plugin.我把它放在 下:

To get rid of the warning you have to add the unintuitive configuration parameter <packagingExcludes> to the configuration of the maven-war-plugin. I put it under <pluginManagement>:

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
            </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

来源:https://issues.apache.org/jira/browse/MWAR-248

这篇关于为什么点“[INFO] WEB-INF/web.xml 已经添加,跳过";何时使用 maven 打包(战争)项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆