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

问题描述

今天在安装Maven项目的时候遇到了如下的这个问题,在这里记录一下。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project meinian_service:
 Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.2:war failed:
 Unable to load the mojo 'war' in the plugin 'org.apache.maven.plugins:maven-war-plugin:2.2' due to an API incompatibility: 
 org.codehaus.plexus.component.repository.exception.ComponentLookupException: null
[ERROR] -----------------------------------------------------
[ERROR] realm =  plugin>org.apache.maven.plugins:maven-war-plugin:2.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

问题分析

为了确定出错的具体原因,笔者将项目依次进行 clean、compile、package
和 install 。发现是在将项目打包的时候出错。到这里,基本可以确定与代码无关了。
随后,在控制台输出的报错信息中发现了一条重要的出错信息即:

realm =  plugin>org.apache.maven.plugins:maven-war-plugin:2.2

解决

猜测可能是因为 maven-war-plugin:2.2这个插件版本太低导致将项目打成war包失败了,然后在pom.xml文件中引入更新版本的插件项目就能正常安装了。到此问题解决。

<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-war-plugin</artifactId>
			<version>3.2.1</version>
</plugin>

这里贴出Maven仓库的地址,可以根据需要获取相应版本:传送门

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值