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

2023-10-11 08:12

本文主要是介绍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)

这篇关于maven依赖下载失败原因分析;_remote.repositories简述的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/186732

相关文章

流媒体平台/视频监控/安防视频汇聚EasyCVR播放暂停后视频画面黑屏是什么原因?

视频智能分析/视频监控/安防监控综合管理系统EasyCVR视频汇聚融合平台,是TSINGSEE青犀视频垂直深耕音视频流媒体技术、AI智能技术领域的杰出成果。该平台以其强大的视频处理、汇聚与融合能力,在构建全栈视频监控系统中展现出了独特的优势。视频监控管理系统EasyCVR平台内置了强大的视频解码、转码、压缩等技术,能够处理多种视频流格式,并以多种格式(RTMP、RTSP、HTTP-FLV、WebS

每天认识几个maven依赖(ActiveMQ+activemq-jaxb+activesoap+activespace+adarwin)

八、ActiveMQ 1、是什么? ActiveMQ 是一个开源的消息中间件(Message Broker),由 Apache 软件基金会开发和维护。它实现了 Java 消息服务(Java Message Service, JMS)规范,并支持多种消息传递协议,包括 AMQP、MQTT 和 OpenWire 等。 2、有什么用? 可靠性:ActiveMQ 提供了消息持久性和事务支持,确保消

性能分析之MySQL索引实战案例

文章目录 一、前言二、准备三、MySQL索引优化四、MySQL 索引知识回顾五、总结 一、前言 在上一讲性能工具之 JProfiler 简单登录案例分析实战中已经发现SQL没有建立索引问题,本文将一起从代码层去分析为什么没有建立索引? 开源ERP项目地址:https://gitee.com/jishenghua/JSH_ERP 二、准备 打开IDEA找到登录请求资源路径位置

常用的jdk下载地址

jdk下载地址 安装方式可以看之前的博客: mac安装jdk oracle 版本:https://www.oracle.com/java/technologies/downloads/ Eclipse Temurin版本:https://adoptium.net/zh-CN/temurin/releases/ 阿里版本: github:https://github.com/

30常用 Maven 命令

Maven 是一个强大的项目管理和构建工具,它广泛用于 Java 项目的依赖管理、构建流程和插件集成。Maven 的命令行工具提供了大量的命令来帮助开发人员管理项目的生命周期、依赖和插件。以下是 常用 Maven 命令的使用场景及其详细解释。 1. mvn clean 使用场景:清理项目的生成目录,通常用于删除项目中自动生成的文件(如 target/ 目录)。共性规律:清理操作

【测试】输入正确用户名和密码,点击登录没有响应的可能性原因

目录 一、前端问题 1. 界面交互问题 2. 输入数据校验问题 二、网络问题 1. 网络连接中断 2. 代理设置问题 三、后端问题 1. 服务器故障 2. 数据库问题 3. 权限问题: 四、其他问题 1. 缓存问题 2. 第三方服务问题 3. 配置问题 一、前端问题 1. 界面交互问题 登录按钮的点击事件未正确绑定,导致点击后无法触发登录操作。 页面可能存在

在cscode中通过maven创建java项目

在cscode中创建java项目 可以通过博客完成maven的导入 建立maven项目 使用快捷键 Ctrl + Shift + P 建立一个 Maven 项目 1 Ctrl + Shift + P 打开输入框2 输入 "> java create"3 选择 maven4 选择 No Archetype5 输入 域名6 输入项目名称7 建立一个文件目录存放项目,文件名一般为项目名8 确定

SWAP作物生长模型安装教程、数据制备、敏感性分析、气候变化影响、R模型敏感性分析与贝叶斯优化、Fortran源代码分析、气候数据降尺度与变化影响分析

查看原文>>>全流程SWAP农业模型数据制备、敏感性分析及气候变化影响实践技术应用 SWAP模型是由荷兰瓦赫宁根大学开发的先进农作物模型,它综合考虑了土壤-水分-大气以及植被间的相互作用;是一种描述作物生长过程的一种机理性作物生长模型。它不但运用Richard方程,使其能够精确的模拟土壤中水分的运动,而且耦合了WOFOST作物模型使作物的生长描述更为科学。 本文让更多的科研人员和农业工作者

MOLE 2.5 分析分子通道和孔隙

软件介绍 生物大分子通道和孔隙在生物学中发挥着重要作用,例如在分子识别和酶底物特异性方面。 我们介绍了一种名为 MOLE 2.5 的高级软件工具,该工具旨在分析分子通道和孔隙。 与其他可用软件工具的基准测试表明,MOLE 2.5 相比更快、更强大、功能更丰富。作为一项新功能,MOLE 2.5 可以估算已识别通道的物理化学性质。 软件下载 https://pan.quark.cn/s/57

maven 编译构建可以执行的jar包

💝💝💝欢迎莅临我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:「stormsha的主页」👈,「stormsha的知识库」👈持续学习,不断总结,共同进步,为了踏实,做好当下事儿~ 专栏导航 Python系列: Python面试题合集,剑指大厂Git系列: Git操作技巧GO