Maven webxml attribute is required

摘要: Maven package a web application and hits the following error message :

Maven package a web application and hits the following error message :

$ mvn package
//...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war 
(default-war) on project spring4-mvc-maven-ajax-example: 
Error assembling WAR: webxml attribute is required 
(or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]

Solution

1. For servlet container < 3, make sure WEB-INF/web.xml file exists.

2. For servlet container >=3, and NO web.xml web application, declares the following maven-war-plugin plugin, and set the failOnMissingWebXml option to false.

pom.xml
  <build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-war-plugin</artifactId>
			<version>2.6</version>
			<configuration>
				<failOnMissingWebXml>false</failOnMissingWebXml>
			</configuration>
		</plugin>
	</plugins>
  </build>	

References

  1. Apache Maven WAR Plugin
  2. Apache Tomcat – Which version do I want?

上一篇: Maven Deploy web application to WildFly
下一篇: Python How to split a String
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号