spring源码导入

构建过两次spring的源码,第一次很顺利就完成了,第二次倒是遇到了不少问题。记录一下

需要注意的几点:

  • gradle的版本选择,需要跟下载的spring源码对应,具体在gradle/wrapper/gradle-wrapper.properties
    的distributionUrl中指出 distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
    gradle版本一开始我选择的是6.0.11版本,在build的时候由于gradle版本太高,id 'com.gradle.build-scan' version '3.2'这个插件无法下载
    还有需要注意idea版本和gradle版本的兼容性,亲测2018版的idea不兼容gradle 5.6,而spring 5.2.8版本的编译又要求gradle版本不低于5.6,后来我升级idea到2020才没有问题
  • build的过程中,遇到了以下错误
Build file 'F:\idea_code\enjoy\spring源码相关\spring-source-5.2.8\build.gradle' line: 6

Error resolving plugin [id: 'io.spring.gradle-enterprise-conventions', version: '0.0.2']
> Could not resolve all dependencies for configuration 'detachedConfiguration5'.
   > Could not determine artifacts for io.spring.gradle-enterprise-conventions:io.spring.gradle-enterprise-conventions.gradle.plugin:0.0.2
      > Could not get resource 'https://repo.spring.io/plugins-release/io/spring/gradle-enterprise-conventions/io.spring.gradle-enterprise-conventions.gradle.plugin/0.0.2/io.spring.gradle-enterprise-conventions.gradle.plugin-0.0.2.jar'.
         > Could not HEAD 'https://repo.spring.io/plugins-release/io/spring/gradle-enterprise-conventions/io.spring.gradle-enterprise-conventions.gradle.plugin/0.0.2/io.spring.gradle-enterprise-conventions.gradle.plugin-0.0.2.jar'. Received status code 401 from server: Unauthorized

 

不知道什么时候开始,从spring的官网仓库下载包或插件需要认证了,这里很明显的一个灭有授权的错误401,但是此时我的build.gradle以及setting.gradle是这样配置的:

	repositories {
			maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
			maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
			mavenCentral()
			jcenter()
			google()
			maven { url "https://repo.spring.io/libs-spring-framework-build" }
		}
	repositories {
		gradlePluginPortal()
		maven { url 'https://maven.aliyun.com/repository/public' }
		maven { url 'https://repo.spring.io/plugins-release' }
	}
	

我已经加了阿里云的源,但似乎不起作用,还是首先去spring官网去加载,于是我只好先把spring的源注释掉,只保留阿里云的。这样开始下一步执行gradlew :spring-oxm:compileTestJava
先编译spring-oxm模块。编译成功之后,再导入到idea中点击build做全局编译。

  • 此时还有一个问题,build.gradle中有个插件无法下载
plugins {
	id 'io.spring.dependency-management' version '1.0.8.RELEASE' apply false
	id 'org.jetbrains.kotlin.jvm' version '1.3.72' apply false
	id 'org.jetbrains.dokka' version '0.10.1' apply false
	id 'org.asciidoctor.jvm.convert' version '2.4.0'
//	id 'io.spring.gradle-enterprise-conventions' version '0.0.2'
	id 'io.spring.nohttp' version '0.0.5.RELEASE'
	id 'de.undercouch.download' version '4.0.0'
	id 'com.gradle.build-scan' version '3.2'
	id "com.jfrog.artifactory" version '4.12.0' apply false
	id "io.freefair.aspectj" version '4.1.1' apply false
	id "com.github.ben-manes.versions" version '0.24.0'
}

就是注释掉的那个id ‘io.spring.gradle-enterprise-conventions’ version ‘0.0.2’,可以先注释掉

  • plugin with id ‘java-test-fixtures‘ not found
    gradle版本要求在5.6.4-6.0之间

  • 这时候大部分模块都编译好了,只剩下一个spring-tx包,它依赖了一个包我这里找不到资源,

Could not find com.ibm.websphere:uow:6.0.2.17.
Required by:
    project :spring-tx

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

这时候可以再把前面注释掉的spring官网的源给放开,就下载下来了。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值