xxx.jar‘. Received status code 401 from server: Unauthorized

背景

  • gradle下载依赖时报一堆的 Received status code 401 from server: Unauthorized问题,具体异常如下所示。
<ij_msg_gr>Project resolve errors<ij_msg_gr><ij_nav>D:\work\self\spring-framework-5.0.8.RELEASE\build.gradle<ij_nav><i><b>root project 'spring': Unable to resolve additional project configuration.</b><eol>Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':testCompileClasspath'.<eol>Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download aspectjweaver.jar (org.aspectj:aspectjweaver:1.8.13)<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'. Received status code 401 from server: Unauthorized</i>
The getTestClassesDir() method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the getTestClassesDirs() method instead.
<ij_msg_gr>Project resolve errors<ij_msg_gr><ij_nav>D:\work\self\spring-framework-5.0.8.RELEASE\build.gradle<ij_nav><i><b>root project 'spring': Unable to resolve additional project configuration.</b><eol>Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':testCompileClasspath'.<eol>Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download aspectjweaver.jar (org.aspectj:aspectjweaver:1.8.13)<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'. Received status code 401 from server: Unauthorized</i>
<ij_msg_gr>Project resolve errors<ij_msg_gr><ij_nav>D:\work\self\spring-framework-5.0.8.RELEASE\spring-aop\spring-aop.gradle<ij_nav><i><b>project ':spring-aop': Unable to resolve additional project configuration.</b><eol>Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':spring-aop:optional'.<eol>Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download aspectjweaver.jar (org.aspectj:aspectjweaver:1.8.13)<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'. Received status code 401 from server: Unauthorized</i>
<ij_msg_gr>Project resolve errors<ij_msg_gr><ij_nav>D:\work\self\spring-framework-5.0.8.RELEASE\spring-aspects\spring-aspects.gradle<ij_nav><i><b>project ':spring-aspects': Unable to resolve additional project configuration.</b><eol>Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':spring-aspects:compileClasspath'.<eol>Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download aspectjweaver.jar (org.aspectj:aspectjweaver:1.8.13)<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'. Received status code 401 from server: Unauthorized</i>
<ij_msg_gr>Project resolve errors<ij_msg_gr><ij_nav>D:\work\self\spring-framework-5.0.8.RELEASE\spring-context\spring-context.gradle<ij_nav><i><b>project ':spring-context': Unable to resolve additional project configuration.</b><eol>Details: org.gradle.internal.resolve.ArtifactResolveException: Could not download aspectjweaver.jar (org.aspectj:aspectjweaver:1.8.13)<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'. Received status code 401 from server: Unauthorized</i>
<ij_msg_gr>Project resolve errors<ij_msg_gr><ij_nav>D:\work\self\spring-framework-5.0.8.RELEASE\spring-core\spring-core.gradle<ij_nav><i><b>project ':spring-core': Unable to resolve additional project configuration.</b><eol>Details: org.gradle.internal.resolve.ArtifactResolveException: Could not download aspectjweaver.jar (org.aspectj:aspectjweaver:1.8.13)<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'. Received status code 401 from server: Unauthorized</i>
<ij_msg_gr>Project resolve errors<ij_msg_gr><ij_nav>D:\work\self\spring-framework-5.0.8.RELEASE\spring-orm\spring-orm.gradle<ij_nav><i><b>project ':spring-orm': Unable to resolve additional project configuration.</b><eol>Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':spring-orm:testCompileClasspath'.<eol>Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download aspectjweaver.jar (org.aspectj:aspectjweaver:1.8.13)<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'. Received status code 401 from server: Unauthorized</i>
<ij_msg_gr>Project resolve errors<ij_msg_gr><ij_nav>D:\work\self\spring-framework-5.0.8.RELEASE\spring-test\spring-test.gradle<ij_nav><i><b>project ':spring-test': Unable to resolve additional project configuration.</b><eol>Details: org.gradle.internal.resolve.ArtifactResolveException: Could not download aspectjweaver.jar (org.aspectj:aspectjweaver:1.8.13)<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'. Received status code 401 from server: Unauthorized</i>
<ij_msg_gr>Project resolve errors<ij_msg_gr><ij_nav>D:\work\self\spring-framework-5.0.8.RELEASE\spring-tx\spring-tx.gradle<ij_nav><i><b>project ':spring-tx': Unable to resolve additional project configuration.</b><eol>Details: org.gradle.internal.resolve.ArtifactResolveException: Could not download aspectjweaver.jar (org.aspectj:aspectjweaver:1.8.13)<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://repo.spring.io/libs-release/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar'. Received status code 401 from server: Unauthorized</i>

在这里插入图片描述

  • 未认证的问题,于是打开链接,看看是什么鬼。
    在这里插入图片描述
  • 看到上图,原因已经找到了,不知道从什么时候开始,从spring的仓库下载东西居然要认证了。
    在这里插入图片描述

解决方案

  • 更换仓库地址。

  • 我这里换成了阿里云的maven仓库:把之前的https://repo.spring.io/libs-release值替换为https://maven.aliyun.com/repository/public。如下图所示。
    在这里插入图片描述

  • 更换后就完成了,再次重新导入就不会报错了,如下所示。
    在这里插入图片描述

  • 另外如果还有包的问题可以参考下,下篇文章Could not resolve: com.ibm.websphere:uow:6.0.2.17

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 25
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 25
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值