禁用 Maven 警告消息-“ Selected war files include a WEB-INF/web.xml which will be 忽略”

当使用 Maven2.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')

有办法消除它吗?它不会失败的建设过程中,但我只是不想看到它。

70487 次浏览

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):

<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>

I've filed the following bug report regarding this issue: https://issues.apache.org/jira/browse/MWAR-248

It seems to be fixed in current version of maven-war-plugin, so just specifying:

    <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.)