问题现象:

用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>

  

Maven打包时报Failed to execute goal org.apache.maven.plugins:maven-war-plugin:解决方案的更多相关文章

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

    出现下面异常,因为默认web.xml在  src/main/webapp  下所以才出现找不到的异常. 我的项目结构为 解决办法①:  在pom.xml里面制定 web位置即可 //先确保打包方式为w ...

  2. 使用idea maven打包项目 Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources

    超级折磨人 在网上搜到的解决方案: 技术交流群 : 816227112 修改 和 <plugin> <groupId>org.apache.maven.plugins</ ...

  3. Maven 错误:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project appservice-common: Fatal error compiling: 无效的目标发行版: 1.8

    通过IDEA 提供的面板 执行package 或者 install 没有错误,但是cmd terminal 窗口就不行!出现: Maven 错误:Failed to execute goal org. ...

  4. maven 编译出错 Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean

    eclipse在使用maven的tomcat控件编译java程序时,报错 Failed to execute goal org.apache.maven.plugins:maven-clean-plu ...

  5. maven bug之Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project acSpaceCommon: Fatal error compiling: tools.jar not found: C:\Program Files\J

    maven打包项目的时候一直报这个异常  一般的解决办法我都试过 在pom.xml加代码 也不行  只有10分了  求大神解答 这是因为测试代码时遇到错误,它会停止编译.只需要在pom.xml的< ...

  6. springboot打包 出错 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1

    遇到这个问题看了很多博客之后发现:执行这个语句就行了:mvn clean package -Dmaven.test.skip=true 本文链接:https://blog.csdn.net/weixi ...

  7. maven build时报错Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test

    [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ ...

  8. 解决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  ...

  9. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法

    Maven install失败 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (d ...

随机推荐

  1. silicon射频发射器 SI4010-C2-GSR

    Si4010是第一款系统级的自动天线调谐发射器,具有专利的调谐电路,可自动微调天线以达到最佳效果,以及恒定的输出功耗.PCB环形天线的制造公差和环境改变,将会引起发射频率的变化,从而可能导致天线的效率 ...

  2. Day1-T3

    原题目 Describe:两个限制条件,求第三属性的最大和 code: #pragma GCC optimize(2) #include<bits/stdc++.h> using name ...

  3. C++基础--函数模板

    函数模板是通用的函数描述,其使用泛型来定义函数.其实就是有些操作,如果撇开具体的变量的数据类型,其操作是一样的如果我们将这些操作写成一个模板,在调用不同变量的时候就设定好变量类型就可了,后续的操作基本 ...

  4. 使用H5搭建webapp主页面

    使用H5搭建webapp主页面 前言: 在一个h5和微信小程序火热的时代,作为安卓程序员也得涉略一下h5了,不然就要落后了,据说在简历上可以加分哦,如果没有html和css和js基础的朋友,可以自行先 ...

  5. PAT Advanced 1034 Head of a Gang (30) [图的遍历,BFS,DFS,并查集]

    题目 One way that the police finds the head of a gang is to check people's phone calls. If there is a ...

  6. Java算法练习——无重复字符的最长子串

    题目链接 题目描述 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度. 示例 1 输入: "abcabcbb" 输出: 3 解释: 因为无重复字符的最长子串是 &qu ...

  7. Dlib笔记一:基本数据结构和基本操作

    编译了Dlib之后就开始想着怎么用起来,先从基本的数据类型说起吧,因为是图像,所以难免会跟OpenCV的数据类型比较.在Dlib中,图像是用二维阵列(array2d)或者矩阵(matrix)来表示的, ...

  8. Java语言概述-JavaSE

    代码虐我千百遍,我视代码如初恋 初级学习思想: 先了解Java 下载中英文文档对照学习 多看,多学 多敲,狂练 多标注注释 总结—创造 https://baike.baidu.com/(Java百度百 ...

  9. npm全局权限设置 - Mac

    网络上的常见方法 目前网络上常见的方法都是修改npm安装路径的权限 通过使用命令 npm config get prefix 得到npm的路径,结果大部分都是/usr/local.然后,很多方法都会要 ...

  10. 7.3 使用while 循环来处理列表和字典

    # 7.3.1 在列表之间移动元素 # confirmed_users.py # 首先,创建一个待验证用户列表 # 和一个用于存储已验证用户的空列表 uncomfirmed_users = ['jam ...