Java 禁用 Maven 警告消息 - “选定的战争文件包含将被忽略的 WEB-INF/web.xml”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4342245/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Disable Maven warning message - "Selected war files include a WEB-INF/web.xml which will be ignored"
提问by Sefler
When building WAR package using Maven 2.1.1, I get this warning message:
使用 Maven 2.1.1 构建 WAR 包时,我收到以下警告消息:
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ig
nored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specifi
ed as 'true')
Is there a way to eliminate it? It doesn't fail the building process, but I just do not want to see it.
有没有办法消除它?它不会使构建过程失败,但我只是不想看到它。
采纳答案by Andrei Amariei
I got rid of this warning in maven 3.0.1 with the following build configuration (i believe perhaps web.xml is added to the project by other means, and should't be packaged by default):
我在 maven 3.0.1 中使用以下构建配置摆脱了这个警告(我相信 web.xml 可能是通过其他方式添加到项目中的,并且默认情况下不应该打包):
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
回答by Gili
I've filed the following bug report regarding this issue: https://issues.apache.org/jira/browse/MWAR-248
我已提交有关此问题的以下错误报告:https: //issues.apache.org/jira/browse/MWAR-248
回答by anre
It seems to be fixed in current version of maven-war-plugin, so just specifying:
它似乎已在当前版本的 maven-war-plugin 中修复,因此只需指定:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
fixed it for me. (See the last answer (20/Sep/12 4:37 AM) from Anders Hammar on https://issues.apache.org/jira/browse/MWAR-248.)
为我修好了。(请参阅https://issues.apache.org/jira/browse/MWAR-248上 Anders Hammar 的最后一个答案(20/Sep/12 4:37 AM)。)