日常Exception第二十三回:Maven导入异常Maven dependencies are failing with a 501 error: user https://repo.maven

Posted 善良勤劳勇敢而又聪明的老杨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了日常Exception第二十三回:Maven导入异常Maven dependencies are failing with a 501 error: user https://repo.maven相关的知识,希望对你有一定的参考价值。

热门系列:


1.问题

通过IDEA使用Maven进行项目Install时,发送了如题的问题:

Maven dependencies are failing with a 501 error: user https://repo.maven.....


2.分析

具体报错是,SpringCloud的依赖无法从远程Maven下载。报错信息中的下载地址如下:

http://repo.maven.apache.org/maven2/org/springframework/cloud/spring-cloud-dependencies/Greenwich.RELEASE/spring-cloud-dependencies-Greenwich.RELEASE.pom

通过浏览器尝试了一下,确实不可下载:

但是,换成就可以正常访问到了。所以,原因就是Maven远程库访问方式导致的不可用了。。

通过参考网上的资料,搜集到如下3种解决方式:

1.Add a repository in your project´s pom.xml file

<project> 
	<repositories> 
		<repository> 
			<id>central maven repo</id> 
			<name>central maven repo https</name> 
			<url>https://repo.maven.apache.org/maven2</url> 
		</repository> 
	</repositories> 
</project>

2.Add the repository into a profile in the settings.xml file.

<profile> 
	<id>my profile</id> 
	<repositories> 
		<repository> 
			<id>central maven repo</id> 
			<name>central maven repo https</name> 
			<url>https://repo.maven.apache.org/maven2</url> 
		</repository> 
	</repositories> 
</profile>

3.Update you maven version to a new one that uses https values as default. The lastest one at this moment 3.6.3 Download here( https://maven.apache.org/download.cgi)

备注:此处就是说,升级自己的Maven版本至最新的版本使用即可!


3.解决

博主采用的是第三种方式!对于前面两种方式,有兴趣的朋友也可以尝试一下!!!

此处还出了一个小插曲,就是我选择了Maven的最新版本3.6.3后,居然出现了另外的报错!!!!我岛。。。。。还是贴下异常信息吧:

2021-03-11 17:41:30,401 [11154097]   INFO -      #org.jetbrains.idea.maven - org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find org.springframework.boot:spring-boot-starter-actuator:jar:sources:2.1.5.RELEASE 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 has elapsed or updates are forced 
java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find org.springframework.boot:spring-boot-starter-actuator:jar:sources:2.1.5.RELEASE 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 has elapsed or updates are forced
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:422)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:224)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:201)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:260)
	at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.resolve(Maven3ServerEmbedderImpl.java:1236)
	at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.doResolve(Maven3ServerEmbedderImpl.java:1178)
	at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.doResolve(Maven3ServerEmbedderImpl.java:1172)
	at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.resolve(Maven3ServerEmbedderImpl.java:1041)
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find org.springframework.boot:spring-boot-starter-actuator:jar:sources:2.1.5.RELEASE 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 has elapsed or updates are forced
	at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:233)
	at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:208)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:563)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:481)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:399)
	... 23 more

这个异常的主要原因是因为,Maven版本与IDEA版本不匹配导致!

博主目前使用的是2018版本的,

而2018版本的IDEA不能使用最新版本的Maven,后来换成  即可!!!至此,问题就解决啦!!!

 

以上是关于日常Exception第二十三回:Maven导入异常Maven dependencies are failing with a 501 error: user https://repo.maven的主要内容,如果未能解决你的问题,请参考以下文章

日常Exception第三十三回:Flink运行jar包报错NoSuchMethodError: org.apache.flink.api.common.functions.Runtime....

日常Exception第二十一回:IDEA Maven构建配置文件失效,target中未正确出现对应环境的配置文件

一起Talk Android吧(第四百二十三回:给图片添加阴影)

一起Talk Android吧(第三百二十三回:Android中网络通信之TCP通信演示)

日常Exception第二十六回:RedisSystemException...RejectedExecutionException: event executor terminated

日常Exception第二十六回:RedisSystemException...RejectedExecutionException: event executor terminated