maven 打包 常见错误问题
2016-08-04 20:25
148 查看
1、web.xml 位置问题
mvn install一个web项目时,报错如下:Error assembling WAR:webxml attribute is required[plain] view
plain copy
[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
plain copy
<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>
相关文章推荐
- maven打包、常见问题、手动添加第三方jar包
- spark整合kafka的maven打包方式常见错误
- 解决Maven并行编译中出现打包错误问题的思路
- 关于Springboot打包错误的问题 | Failed to execute goal org.springframework.boot:spring-boot-maven-plugin
- Maven常见问题、异常、错误整理【持续更新】
- Maven 打包时报Fatal error compiling: tools.jar not found错误的问题处理
- maven常见问题处理(3-2)maven打包时跳过测试的几个方法
- maven中文乱码问题——打包错误
- 一种常见的maven打包后同名文件冲突错误
- VS.net 安装、调试的常见问题与错误[转]
- asp + Access 常见的数据库访问失败问题 Microsoft JET Database Engine 错误 '80004005' 解决办法
- asp + Access 常见的数据库访问失败问题 Microsoft JET Database Engine 错误 '80004005' 解决办法
- Net 下安装、调试的常见问题与错误!!!
- .Net 下安装、调试的常见问题与错误!!!
- asp + Access 常见的数据库访问失败问题 Microsoft JET Database Engine 错误 '80004005' 解决办法
- 安装、调试的常见问题与错误
- 常见的IIS问题,201错误
- ORACLE数据库问题诊断方法 :常见错误篇
- 一网打尽 .Net 开发过程中安装、调试的常见问题与错误!
- 针对上午的"asp.net最常见的错误总结"的问题的解决方法!