Why point “[INFO] WEB-INF/web.xml already added, skipping” when packaging(war) the project using maven?

匿名 (未验证) 提交于 2019-12-03 01:06:02

问题:

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

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

回答1:

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>

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!