spring源码编译问题解决1,Received status code 401 from server问题,not found问题,更换阿里云镜像

问题

用gradlew install或者gradlew build下载spring源码依赖时,报not found与401错误。

原因

问题1:
not found 是使用的仓库里不存在该文件,比如说你要下gradle插件或者spring依赖,public仓库当然没有,你需要另外加上阿里云的gradle/spring仓库。

–>去阿里云仓库官网

在这里插入图片描述
你需要加上正确的阿里云仓库,幸运的是我们可以把所有的阿里云仓库地址都放进仓库地址。

问题2:
401是权限不够,spring仓库部分文件现在需要登陆才能下载,所以报权限错误。

两个问题的解决办法

把build.gradle里所有的仓库地址都换成阿里云仓库,记住可能有多处!!,除buildscript{}闭包内要改repositories{}外,configure(allprojects) {}闭包里的repositories{}仓库地址也要改。

repositories {
		//阿里云仓库全家桶
		maven{ url 'https://maven.aliyun.com/repository/central'}
		maven{ url 'https://maven.aliyun.com/repository/public' }
		maven{ url 'https://maven.aliyun.com/repository/google'}
		maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
		maven{ url 'https://maven.aliyun.com/repository/spring'}
		maven{ url 'https://maven.aliyun.com/repository/spring-plugin'}
		maven{ url 'https://maven.aliyun.com/mvn/guide'}
		maven{ url 'https://maven.aliyun.com/repository/apache-snapshots'}
}

温馨提示:
gradle不用自己下载,gradlew在运行时会自己下载适合的版本,下载的版本可以在spring-framework-4.2.x\gradle\wrapper\gradle-wrapper.properties的下载地址配置中看到。

# gradle-wrapper.properties
# Thu Jul 09 16:54:55 EEST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
# 下载地址配置,可看到下载的gradle版本为2.5,复制该地址去除'https\://***'后的 '\'后也可以手动下载,不建议手动下载还要配置环境变量,麻烦
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-bin.zip
  • 22
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

tazuxianzai

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值