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

When eclipse builds the war package through maven, the following error occurs:

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

is found as follows, it is very clear
http://blog.csdn.net/vking_wang /article/details/8731824

[Problem description]:
[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>


[Problem Analysis]:
My project is a dynamic web project in eclipse, and provides Maven support, in which the web project package is war.
The default webroot of the web maven project is src\main\webapp. The above exception is thrown if web.xml is not found in this directory.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326360290&siteId=291194637