maven 本地依赖存在但还是报依赖无法找到的错误

情况

一般是存在于假设有私服的maven项目中。明明依赖的Jar包已经在本地仓库中存在,但是编译的时候还是出现依赖错误,Could not resolve dependencies for project

原因

Maven 3.0+ enforces that downloaded artifacts were resolved from a repository url/id that matches an url available for the current session.

解决

IIRC there is a CLI option that you can enabled in Maven 3.1.1 that tells Maven “I know what I am doing and don’t make that check this time” i.e. --legacy-local-repository

  1. 正确的解决方式:增加命令行参数 --legacy-local-repository 避免maven查询远程仓库的依赖
  2. 删除错误jar依赖仓库中所在文件夹的 _remote.repositories 的文件

参考

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值