maven依赖下载失败原因分析;_remote.repositories简述

概述

我的maven版本3.6.3

有时在下载maven依赖时,提示某个仓库中没有对应依赖,此时去提示的仓库上找,的确没有,那么通常会加入mirror拦截一下依赖请求,指向到mirrot中的仓库,但是此时仍提示相同的错误。
更奇怪的是,即使此时本地仓库中有依赖,但还是提示某个仓库地址上依赖不存在。

查了一通,资料,到对应依赖下把_remote.repositories文件删除,重新下载依赖就ok了。

附上一个相同问题的Stack Overflow连接
https://stackoverflow.com/questions/16866978/maven-cant-find-my-local-artifacts

_remote.repositories

大致就是说_remote.repositories这个文件是为了标识依赖的来源,需要保证这个来源中依赖一定存在。

这个文件内容大概如下,>符号后的字符为setting文件中配置的<mirror>标签下的id.
如下demo中我用是mirroraliyun的这里展示的就是aliyun
在这里插入图片描述

官方解释

Prior to Maven 3.0.x, Maven did not track the origin of files in the
local repository.

This could result in build issues, especially if you were building
something that listed the (now dead) very borked java.net2
repository… Not only did that repository change released artifacts
(extremely bad and evil practice) but it also published artifacts at
the same coordinates as artifacts on central but with different
content (unbelievably evil)

So you could have the build work (because you had
commons-io:commons-io:2.0 from central) wipe your local repo and the
build fails (because you now get commons-io:commons-io:2.0 from
java.net2 which was a completely different artifact with different
dependencies in the pom) or vice versa.

The above situation is one of the drivers for using a maven repository
manager, because that allows you to control the subset of a repository
that you expose downstream and the order in which artifacts are
resolved from multiple repositories (usually referred to as routing
rules)

In any case, when maven switched to Aether as the repository access
layer, the decision was made to start tracking where artifacts come
from.

So with Maven 3.0.x, when an artifact is downloaded from a repository,
maven leaves a _maven.repositories file to record where the file was
resolved from. If you are building a project and the effective list of
repositories does not include the location that the artifact was
resolved from, then Maven decides that it is as if the artifact was
not in the cache, and will seek to re-resolve the artifact…

There are a number of bugs in 3.0.x though… The most critical being
how offline is handled… Namely: when offline, maven 3.0.x thinks
there are no repositories, so will always find a mismatch against the
_maven.repositories file!!!

The workaround for Maven 3.0.x is to delete these files from your
local cache, eg

$ find ~/.m2/repository -name _maven.repositories -exec rm -v {} ;
The side effect is that you loose the protections that Maven 3.0.x is
trying to provide.

The good news is that Maven 3.1 will have the required fix (if we can
ever get our act together and get a release out the door)

With Maven 3.1 when in offline mode the _maven.repositories file is
(semi-)ignored, and there is also an option to ignore that file for
online builds (referred to as legacy mode)

At this point in time (June 1st 2013) the 4th attempt to cut a release
that meets the legal and testing requirements is in progress… So,
assuming that the 4th time is lucky, I would hope to see 3.1.0-alpha-1
released in 3-4 days time… But it could be longer given that we want
to give the changes in 3.1 enough time to soak to ensure uses builds
don’t break (there was a change in an API exposed (by accident-ish -
the API is needed by the site and dependency plugin) that plugin
authors have depended on (even though they shouldn’t have) so there is
potential, though we think we have all the bases covered)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/130032.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

运维知识点汇总

一.公共基础 linux常用目录 链接一 链接二 linux系统启动 链接一 链接二 LVM 链接一 磁盘挂载 链接一 文件权限 链接一 二.VLAN详解 链接 三.中间件 单体部署&#xff1a; 优点&#xff1a; &#xff08;1&#xff09;小团队成型即可完成开发-测试-上线&am…

鸿蒙手表开发之使用adb命令安装线上包

#国庆发生的那些事儿# 鸿蒙手表开发之使用adb命令安装线上包 前言&#xff1a; 由于之前的哥们匆忙离职了&#xff0c;所以鸿蒙手表项目的新版本我临时接过来打包发布&#xff0c;基本上之前没有啥鸿蒙经验&#xff0c;但是一直是做Android开发的&#xff0c;在工作人员的指…

AIGC | LLM 提示工程 -- 如何向ChatGPT提问

当前生成式人工智能已经成为革命性的驱动源&#xff0c;正在迅速地重塑世界&#xff0c;将会改变我们生活方式和思考模式。LLM像一个学会了全部人类知识的通才&#xff0c;但这不意味每个人可以轻松驾驭这个通才。我们只有通过学习面向LLM的提示工程&#xff0c;才可以更好的让…

MySQL——单表与多表查询练习

MySQL 一、练习一二、练习二 一、练习一 这里首先将素材创建完毕&#xff0c;首先创建一个数据库并使用&#xff0c;这里我创建的数据库名为worker&#xff1a; 紧接着我们创建数据库表并创建表结构&#xff1a; 查看表结构&#xff1a; 接着我们导入数据&#xff1a; 这…

Python字典全解析:从基础到高级应用

更多资料获取 &#x1f4da; 个人网站&#xff1a;涛哥聊Python 字典是一种强大而多才多艺的数据类型&#xff0c;它以键-值对的形式储存信息&#xff0c;让我们能够以惊人的效率处理和管理数据。 字典能够将键和值关联在一起&#xff0c;使得数据的存储和检索变得非常高效。…

腾讯云/阿里云国际站代理:国际版账号购买国内外域名解析的方法及疑难问题解答

国内外域名解析实际比较简单&#xff0c;但新手小白总遇到问题&#xff0c;所以整理这个教程。腾讯云南国际版账号购买写教程的起因是&#xff1a;国外域名注册商dns.mba&#xff08;现已更名为ymp.com&#xff09;拥有相当多的用户&#xff0c;但其域名解析到国内绝对不简单。…

c++桥接模式,中介者模式应用实现状态跳转

上图为例&#xff0c;按上述两种方式实现的模式跳转&#xff0c;如果在原先的三种模式之间再增加多一种模式&#xff0c;就会引起每个模式都会要求改变&#xff0c;并且逻辑混乱&#xff0c;因此更改模式为桥接中介者访问&#xff0c;将抽象和实现分离&#xff0c;实现之间采用…

【JavaEE】文件操作

文章目录 前言什么是文件树型结构组织和目录文件路径文件类型文件权限Java中的文件操作File 类的常见属性File 类常见构造方法File 类常用方法 前言 文件是我们日常生活中使用非常广泛的&#xff0c;我们使用任何一个程序都离不开文件操作&#xff0c;这个文件不仅仅指平时可以…

常见开源协议介绍

开源协议&#xff08;Open Source License&#xff09;是一种法律文档&#xff0c;用于规定如何使用、修改和分发开源软件和其他开源项目的规则和条件。这些协议允许创作者或组织将其创造的代码或作品以开放源代码的形式共享给他人&#xff0c;以促进协作、创新和知识共享。常见…

Springboot之AOP的执行顺序

AOP执行顺序验证 项目引入了依赖。自动开启了aop的配置。 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-aop</artifactId></dependency>切面上配置Order注解 切面类AopTest1&#xff0c;ord…

【数据结构C/C++】顺序与链式二叉树创建与前中后、层序遍历

文章目录 顺序存储结构二叉树链式存储结构二叉树刷题推荐408考研各数据结构C/C代码&#xff08;Continually updating&#xff09; 顺序存储结构二叉树 顺序存储结构的二叉树的特点在于&#xff0c;其使用数组存放二叉树中的每一个节点。 我们设定根节点的数组索引下标为n&…

MM-Camera架构-ProcessCaptureRequest 流程分析

文章目录 processCaptureRequest\_3\_41.1 mDevice1.2 mDevice->ops->process\_capture\_request1.3 hardware to vendor mct\_shimlayer\_process\_event2.1 mct\_shimlayer\_handle\_parm2.2 mct\_shimlayer\_reg\_buffer processCaptureRequest_3_4 sdm660的摄像头走…