• Maven工程Missing artifact 解决方法


    前提说明

    =======

    maven版本:3.2.2

    eclipse已经正确引入自己安装的maven,且设置好仓库位置

    出现错误

    引入maven工程时,pom.xml出现错误如:

    出错原因

    一般都是导入别人的工程,因为自己的maven环境、仓库配置信息、下载的jar包来源、甚至时IDE环境不一致导致

    解决思路

    =======

    1.检查maven本地仓库中是否存在改包

    (1)若存在:删掉_maven.repositories和_remote.repositories文件(或用文本编辑器打开,将“>main=”改为“>=”,即删除main,当然main也可能是其他值),删除xxxx.lastUpdate相关文件,然后update project 或 update dependency

    (2)不存在看第2条

    2.settings.xml文件是否配置了mirror,即maven下载jar的仓库;是否联网;若都没问题看第3条

    3.去settings.xml文件配置的mirror仓库地址查看对应的jar是否存在这个仓库。若找不到,那就换mirror吧,推荐国内网速较快的镜像地址:

    	
    		alimaven
    		aliyun maven
    		http://maven.aliyun.com/nexus/content/groups/public/
    		central
    	
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    放到标签中即可

    或者其它mirror地址如:开源中国的等等

    4.直接去maven中央仓库手动对应版本的jar,放到本地仓库对应位置,删除文件夹内不相关文件,重新项目右键–>maven -->update 依赖或者update project

    注:
    所有关于maven配置或jar或依赖的变更最好都重新:项目右键–>maven -->update dependency或者update project

    自己解决方式

    =========

    找到了我的仓库对应的jar位置,发现存在改jar,删除对应的jar:

    eclipse中对项目:右键–>maven—>update project

    问题解决!

    附加

    =====

    _maven.repositories简介:

    _maven.repositorieshold the information about the origin of the artefacts.Maven tries to update your jar from the old location (as saved in _maven.repositories) and fails. The presumtion here is that the same aftifact on a different remote repository might be different.

    以上为个人尝试过的解决方案,若有其它解决方案,或者出错说明,欢迎留言,不胜感激!

  • 相关阅读:
    【EI会议征稿】2024年第四届人工智能、自动化与高性能计算国际会议(AIAHPC 2024)
    入门力扣自学笔记149 C++ (题目编号1608)
    c++标准模板库:STL
    【Vue基础系列】vue-router 万字详解,一篇彻底搞懂
    深入了解JUC并发(一)什么是JUC
    求解数组中N数之和最接近目标值的算法详解
    【云原生 | 18】Docker数据卷及卷的持久化问题
    cocos creator 小游戏允许他人访问本地项目
    区间统计——ST算法
    Java异常:基本概念、分类和处理
  • 原文地址:https://blog.csdn.net/m0_67390963/article/details/126435410