[Java][Maven]Maven部署Web项目报错webxml attribute is required
2014-08-27 11:22
513 查看
mvn install一个web项目时,报错如下:Error assembling WAR:webxml attribute is required
[plain]
view plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/9e12f1d3e499fc949c886e7c9e0484f9)
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war
(default-war) on project com.alpha.webapp: 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
原因:
maven的web项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。
解决办法:需要在pom.xml中增加<webResources>配置,如下:
[html]
view plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/9e12f1d3e499fc949c886e7c9e0484f9)
<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webXml>WebContent\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
[plain]
view plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war
(default-war) on project com.alpha.webapp: 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
原因:
maven的web项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。
解决办法:需要在pom.xml中增加<webResources>配置,如下:
[html]
view plaincopy
![](https://oscdn.geek-share.com/Uploads/Images/Content/201611/a7c8e286f463007e2a900848b93dd72c.png)
<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webXml>WebContent\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
相关文章推荐
- [Java][Maven]Maven部署Web项目报错webxml attribute is required
- [Java][Maven]Maven部署Web项目报错webxml attribute is required
- [Java][Maven]Maven部署Web项目报错webxml attribute is required
- 【Maven】Maven部署Web项目报错webxml attribute is required
- Maven部署Web项目报错webxml attribute is required
- Maven打包web项目报错Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if
- Maven打包web项目报错Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if
- 【maven 报错】maven项目执行maven install时报错Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
- 构建maven项目时候报错 web.xml is missing and <failOnMissingWebXml> is set to true
- MAVEN: Error assembling WAR: webxml attribute is required
- maven-install报错:webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update
- 项目重新部署后报The attribute required is undefined for the annotation type XmlElementRef
- Maven报错:Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml
- 解决 "检出Maven项目web.xml is missing"错误 和 “Dynamic Web Module 3.0 requires Java 1.6 or newer.”错误
- weblogic部署异常: cvc-enumeration-valid: string value '3.0' is not a valid enumeration value for web-app-versionType in namespace http://java.sun.com/xml/ns/javaee:<null>
- 解决Tomcat启动多个web项目报错nested exception is java.lang.OutOfMemoryError: PermGen space
- 【团队-java-maven】在java项目中部署maven(1)论我为什么花了好几天,把我的普通web工程转成maven...
- Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml
- eclipse部署maven web项目到tomcat服务器时,没有将lib、web.xml复制过去的解决办法
- Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in