Maven打包时报Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war解决方案

转载 2018年04月17日 14:15:16

问题现象:

用Maven打包时,报Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war错误。

原因分析:

打包时在WebContent/WEB-INF/文件夹下找不到web.xml文件。

解决方案:

如果WebContent/WEB-INF/web.xml文件存在,需要在pom.xml文件的<build>节点中,加上maven-war-plugin插件配置。

[plain] view plain copy
  1. <plugins>  
  2.     <plugin>  
  3.         <groupId>org.apache.maven.plugins</groupId>  
  4.         <artifactId>maven-war-plugin</artifactId>  
  5.         <version>3.0.0</version>  
  6.         <configuration>  
  7.             <webResources>  
  8.                 <resource>  
  9.                     <directory>WebContent</directory>  
  10.                 </resource>  
  11.             </webResources>  
  12.         </configuration>  
  13.     </plugin>  
  14. </plugins>  

如果WebContent/WEB-INF/web.xml文件不存在,则按下面的方式配置。

[plain] view plain copy
  1. <plugins>  
  2.     <plugin>  
  3.         <groupId>org.apache.maven.plugins</groupId>  
  4.         <artifactId>maven-war-plugin</artifactId>  
  5.         <version>3.0.0</version>  
  6.         <configuration>  
  7.             <failOnMissingWebXml>false</failOnMissingWebXml>  
  8.         </configuration>  
  9.     </plugin>  
  10. </plugins>  

webpack模块打包工具教程

课程主要针对webpack的几大关键项entry、output、loaders和plugins进行了详细介绍。其中重点和难点的代码分割功能,在课程中会通过具体实例讲述说明。最后一部分额外讲述了webpack-dev-server的代理使用
  • 2016年11月07日 23:48

【maven install报错】Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war

maven install报错如下:[INFO] Scanning for projects... [INFO] Downloading: http://xxx.xx.xx.x:xxxx/nexus/...
  • lmb55
  • lmb55
  • 2017-07-27 08:41:49
  • 1931

Failed to execute goal org.apache.maven.plugins:maven-war-plugin 解决办法

使用maven打包时,报错误信息:[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (d...
  • a_bang
  • a_bang
  • 2017-06-03 01:35:12
  • 6002

maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-wa

maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-wa
  • zmycoco2
  • zmycoco2
  • 2014-02-19 11:15:05
  • 4220

Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project Th

错误信息:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on proje...
  • mafan121
  • mafan121
  • 2015-11-08 16:57:32
  • 3584

maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war

maven打包成war时,报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-...
  • xiaomageit
  • xiaomageit
  • 2016-03-16 21:52:28
  • 742

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on pr

以前是在eclipse中将maven项目打包,今天在idea打包maven项目中遇到错误信息[ERROR] Failed to execute goal org.apache.maven.plugin...
  • LEoe_
  • LEoe_
  • 2017-10-25 21:17:06
  • 378

解决maven打war包报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2

一、报错经历:今天使用eclipse通过maven install打war包的时候,出现了下图所示的错误二、问题分析:不能执行依赖包maven-compiler-plugin:2.3.2,判断原因是缺...
  • qq_26230421
  • qq_26230421
  • 2018-02-05 11:51:18
  • 954

Eclipse结合Maven出现[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin错误的解决方法

使用 eclipse JavaEE 版。在新安装环境的机器上或者eclipse更换了工作空间的时候,编译 Maven 项目,有可能出现了下面的错误: [ERROR] Failed to execu...
  • zhangchao19890805
  • zhangchao19890805
  • 2017-01-24 11:05:28
  • 5992

Maven部署到Tomcat出现错误:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1

大家都知道错误内容相同时,出现的场景也不一定相同。所以本篇提出的错误解决方案可能仅仅适用跟我相同场景下的情况。 1、出现错误的场景: 按照我之前一篇文章【Eclipse中Maven的集成和使用介绍...
  • muyi_amen
  • muyi_amen
  • 2016-12-16 10:43:30
  • 5424
收藏助手
不良信息举报
您举报文章:Maven打包时报Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war解决方案
举报原因:
原因补充:

(最多只允许输入30个字)