101

When building WAR package using Maven 2.1.1, I get this warning message:

[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 Answers 3

84

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

2
  • 1
    Agreed. As of version 2.3, they finally took care of this annoying warning message for OCD programmers like me :) Commented Nov 27, 2012 at 3:24
  • Yes, this fixed it, however somehow <webXml>src/main/webapp/WEB-INF/web.xml</webXml> didn't for me using version 2.1.1
    – Bizmarck
    Commented Oct 2, 2013 at 20:10
79

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>
6
  • 21
    I found you can add this to the configuration to be sure web.xml makes it in. At this time it appears optional, but better safe than sorry. <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
    – bhavanki
    Commented Jul 21, 2011 at 13:43
  • Including the project-relative path doesn't seem to work; however, the format in the answer does. Commented Jan 23, 2012 at 18:04
  • I'll try this. Within <configuration> I also have <warName>${package.final.name}</warName>. What does this do?
    – Xonatron
    Commented Feb 1, 2012 at 17:10
  • 1
    I had to use <version>2.2</version> or the war will contain a default web.xml instead of the one I specify. 2.1.1 worked for a while, but not anymore. Commented Feb 22, 2012 at 21:05
  • 4
    I am down-voting this response, because while it does get rid of the error warning, it is the wrong and confusing thing to do! You should do what shockwave described or if you are happy with the default web.xml then don't write one yourself at all. Commented Oct 17, 2012 at 16:07
23

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

2
  • This bug is reported as closed but I get this message in maven 3.0.4 on windows 7. Even after adding <webXml>src/main/webapp/WEB-INF/web.xml</webXml> to my pom.xml
    – simgineer
    Commented Jul 9, 2012 at 20:57
  • @simgineer, you should comment inside the bug report. If that doesn't help, consider opening a new bug report and linking to it from here.
    – Gili
    Commented Jul 10, 2012 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.