Failure to find xxx in http://maven.aliyun.com/nexus/content/groups/public

【maven报错】

报错问题

Failure to find io.iec.edp:caf-boot-parent:pom:0.3.4 in http://maven.aliyun.com/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forced

报错解释: 这个错误提示,本地仓库有xxx.jar包,但是中央仓库没有该包,所以报错。

报错分析(重点):我的项目出现这种maven错误,主要是因为maven配置文件setting.xml的位置存放问题!!

解析: 因为公司项目用到的maven和我平时练习用的maven的配置文件不同,所以我在maven文件夹下创建了另一个文件夹,把公司的maven配置文件放到这里,然后在idea中设置maven配置文件时选的这个,然后便一直报上述的那个错误。

如图:(这里我没有把setting.xml配置文件放到conf文件夹下)
在这里插入图片描述

中间本人找了各种办法,参考了许多其他博客的解决办法,但是都没有解决上述异常。

解决办法: 最后,通过查看maven学习笔记,忽然发现maven的配置文件注意事项:重点来了!!!

maven的setting.xml配置文件,一般存放于maven安装路径下的conf文件夹下,代表maven的全局配置。

如图:

在这里插入图片描述

我之前是把公司的那个setting.xml配置文件放在了另一个文件夹,并没有把他放在conf这个文件夹下,所以!!!

即便idea中把maven的配置文件设置了,它也不会生效!!只有conf文件夹下的或C盘.m2文件夹中的配置文件setting.xml 会生效!!!这便是解决办法!(关于.m2文件中的配置文件,总结中有解释)

总结

settings.xml文件一般存在于Maven的安装目录的conf子目录下面,或者是用户目录的.m2子目录下面。

在这里插入图片描述

其实相对于多用户的PC机而言,在Maven安装目录的conf子目录下面的settings.xml才是真正的全局的配置。

而用户目录的.m2子目录下面的settings.xml的配置只是针对当前用户的。当这两个文件同时存在的时候,那么对于相同的配置信息,用户目录下面的settings.xml中定义的会覆盖Maven安装目录下面的settings.xml中的定义。

另外!用户目录下的settings.xml文件一般是不存在的,但是Maven允许我们在这里定义我们自己的settings.xml,如果需要,在这里定义我们自己的settings.xml的时候就可以把Maven安装目录下面的settings.xml文件拷贝到用户目录的.m2目录下,然后改成自己想要的样子。

由此!

综上所述,maven的配置文件settting.xml,只有将其放在conf文件夹下或C盘用户目录的.m2目录下,才会生效!

题外

另外,报如上所述的异常,并不一定只是配置文件的位置问题,还有可能是其他问题,比如配置文件中的远程镜像配置等等。这里列出我参考过的文章:

https://blog.csdn.net/heyianliunian/article/details/121048854
https://blog.csdn.net/Hello_Ray/article/details/87937506
https://blog.csdn.net/Frankenstein_/article/details/100885761

引用:Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.1.RELEASE from http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.1.RELEASE from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): maven.aliyun.com 引用:解决maven引入hive的jar包时依赖报错Could not find artifact org.pentaho:pentaho-aggdesigner-algorithm:pom:5.1.5-jhyde in xxx的问题,maven路径org/pentaho/pentaho-aggdesigner-algorithm/5.1.5-jhyde/pentaho... 引用:maven配置文件,setting.xml中: <mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>*</mirrorOf> </mirror> --> </mirrors> 在您的问题中,您遇到了"Could not find artifact org.springframework.boot:spring-boot-starter:pom:2.0.0.M4 in nexus-aliyun"的错误。这个错误意味着在nexus-aliyun中找不到对应的依赖包。根据引用中的信息,可能是因为该依赖包在本地仓库中被缓存了,并且在指定的更新间隔内不会重新尝试解析。另外,您的maven配置文件中的引用显示了一个镜像配置,其中指定了aliyun maven作为镜像源。所以您可能需要检查一下您的maven配置文件,确保nexus-aliyun是正确配置的镜像源。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值