禁用Maven警告消息 - “选定的war文件包含将被忽略的WEB-INF / web.xml”

时间:2022-11-08 23:58:05

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.

有没有办法消除它?它不会使构建过程失败,但我只是不想看到它。

3 个解决方案

#1


78  

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>

#2


82  

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

为我修好了。 (请参阅安德玛·哈马尔的最后一个答案(20 / Sep / 12 4:37 AM),网址为https://issues.apache.org/jira/browse/MWAR-248。)

#3


23  

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

#1


78  

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>

#2


82  

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

为我修好了。 (请参阅安德玛·哈马尔的最后一个答案(20 / Sep / 12 4:37 AM),网址为https://issues.apache.org/jira/browse/MWAR-248。)

#3


23  

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