mvn编译“Cannot find matching toolchain definitions for the following toolchain types“报错解决方法

问题

git clone https://github.com/apache/shiro.git
git checkout shiro-root-1.2.4
cd ./shiro/samples/web

在编译demo时,遇到报错:

 Cannot find matching toolchain definitions for the following toolchain types:
[ERROR] jdk [ vendor='sun' version='1.7' ]
[ERROR] Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file.

解决方法

1 修改mvn配置文件

配置文件路径

修改内容为,本地的jdk的java_home,以及对应jdk版本,注意这里可以写多个jdk版本,只要本地有:

  <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.8</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/</jdkHome>
    </configuration>
  </toolchain>

2 检测项目pom文件:

搜索toolchains,修改对应版本为刚才mvn的配置文件中指定一个版本,这里必须是刚才配置的jdk版本中有的版本

3 mvn package

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值