maven 本地依赖存在但还是报依赖无法找到的错误 您所在的位置:网站首页 maven本地库有但是找不到 maven 本地依赖存在但还是报依赖无法找到的错误

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

2023-12-13 08:25| 来源: 网络整理| 查看: 265

情况

一般是存在于假设有私服的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

正确的解决方式:增加命令行参数 --legacy-local-repository 避免maven查询远程仓库的依赖删除错误jar依赖仓库中所在文件夹的 _remote.repositories 的文件 参考 https://stackoverflow.com/questions/32571400/remote-repositories-prevents-maven-from-resolving-remote-parenthttp://maven.40175.n5.nabble.com/Cannot-find-parent-POM-but-it-s-there-td5776845.html


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有