`

Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web

阅读更多
eclipse通过maven打war包的时候,发生如下错误提示

Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web

找到如下文,说的很清楚
http://blog.csdn.net/vking_wang/article/details/8731824

【问题描述】:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project XFireTest: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

【问题解决】:

 <build>
	<finalName>simple-webapp</finalName>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-war-plugin</artifactId>
			<version>2.1.1</version>
			<configuration>
				<webResources>
					<resource>					
					<!-- this is relative to the pom.xml directory -->
					<directory>WebContent</directory>
					</resource>
				</webResources>
			</configuration>
		</plugin>
	</plugins>
  </build>


【问题分析】:
我的项目时eclipse中的dynamic web project,并且提供Maven支持,其中在web项目package为war。
Web的maven项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics