Computing Magazine

Webxml Attribute Is Required Error in Maven

Posted on the 22 January 2014 by Abhishek Somani @somaniabhi
Servlet 3.0 API has many nice features in it . One of the most important feature of this release is ease of development . Now you don't have to write configurations related things in web.xml , you can write all these things by using annotations . So , from servlet 3.0 , web.xml is optional (however , if web.xml is present , it will be given preference over annotations ) . If you are using maven for packaging your war , you might get following error if you don't have web.xml in your application .

Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project webSocketExample: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
You can resolve this error by adding following lines in your pom.xml

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
Webxml Attribute Is Required Error in Maven

Back to Featured Articles on Logo Paperblog

Magazines