问题现象:

用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插件配置。

<plugins>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-war-plugin</artifactId>  <version>3.0.0</version>  <configuration>  <webResources>  <resource>  <directory>WebContent</directory>  </resource>  </webResources>  </configuration>  </plugin>
</plugins>  

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

<plugins>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-war-plugin</artifactId>  <version>3.0.0</version>  <configuration>  <failOnMissingWebXml>false</failOnMissingWebXml>  </configuration>  </plugin>
</plugins>

  

转载于:https://www.cnblogs.com/nunuAction/p/6807476.html

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

  1. 使用idea进行Maven打包异常:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war

    使用idea进行Maven打包异常:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war 参考文章: (1) ...

  2. springboot maven 打包失败 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2

    maven 打包失败 一.问题描述: idea打包springboot项目,控制台提示: Failed to execute goal org.apache.maven.plugins:maven-s ...

  3. maven bug之Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (defau

    maven bug之Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (defau ...

  4. maven打包异常-Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEAS

    问题再现 在进行mvn打包的时候出现: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.R ...

  5. 解决Failed to execute goal org.apache.maven.plugins

    1.Maven构建失败 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 2.3 . 2 :compile  ...

  6. maven打包报错:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test

    mvn compile  没有问题,mvn package的时候报如下错误: Failed to execute goal org.apache.maven.plugins:maven-surefir ...

  7. maven打包报错Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.6.1:cle

    问题记录: maven打包报错Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.6.1:cle 解决办法: 这个 ...

  8. 使用maven打war包时报[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war...

    起因: maven项目中放置web.xml文件的资源文件夹写成了webapps 分析: maven的web项目默认是在src\main\webapp.如果在此目录下找不到web.xml就抛出该异常. ...

  9. maven打包报错 Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar

    Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar (default-jar) on project ...

最新文章

  1. npm切换到淘宝镜像
  2. 试图更改利润中心,但物料库存仍然存在
  3. 保险运用计算机的工作干什么,关于计算机在保险业务中的应用研究
  4. 启明云端WT516P6Core离线语音模块发布后,开发者朋友提出的问题最多的是:是否可以自己编译指令
  5. Vue2.0 传值方式
  6. C#_TextBox_禁止粘贴
  7. [论文写作] vscode + latex
  8. spark共享变量(广播变量Broadcast Variable,累加器Accumulators)
  9. input file 上传图片判断图片的宽高尺寸
  10. centos挂载第二块硬盘
  11. Atitit 搜集热点,热门文章的整理 attilax 最近
  12. 破而后立,破除陈旧,认识自我,而后顶天立地!
  13. python图像色彩分析_使用OpenCV和Python计算图像的“色彩”
  14. debian7开机启动
  15. 火车进站(出栈顺序问题)
  16. logcat 实时输出日志到文件(logcat输出日志到文件、同时包括多个TAG)
  17. IoT 开发,我们需要学习哪些内容?
  18. Android ADB USB 驱动 万能配置方式
  19. [carla入门教程]-1 安装carla环境
  20. 转转二手交易网成为更多人选择的交易平台

热门文章

  1. JS遮罩插件 -- JqLoad
  2. ssm整合2 增删改
  3. 悬剑武器库之5种工具学习(shiro检测插件、子域名、信息收集、暴力破解等)
  4. C#为什么要用到 try...catch... 呢?
  5. Scala入门到精通——第八节 包和引入
  6. 聊聊JVM(六)理解JVM的safepoint
  7. Elasticsearch架构原理
  8. docker镜像、容器以及命令操作
  9. 机器学习基础——支持向量机
  10. Vue2.x 踩坑与总结