spring源码学习-初始篇

我使用的是idea来学习spring 的源码

根据import-into-idea.md

_Within your locally cloned spring-framework working directory:_

1. Precompile `spring-oxm` with `./gradlew :spring-oxm:compileTestJava`
2. Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle)
3. When prompted exclude the `spring-aspects` module (or after the import via File-> Project Structure -> Modules)
4. Code away

执行下面的代码,添加了指令,执行的过程更加清晰一些。

.\gradlew.bat --warning-mode all --info --no-build-cache --stacktrace  clean :spring-oxm:compileTestJava

修改的位置

  1. 使用本地的gradle
# distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip
	distributionUrl=file\:///D:/java/gradle-6.1-bin.zip
  1. kotlin 使用的是1.4版本的 idea【setting->plugs->kotlin】需要做到统一
compileKotlin {
	kotlinOptions {
		jvmTarget = "1.8"
		freeCompilerArgs = ["-Xjsr305=strict"]
		apiVersion = "1.4" //之前是1.1
		languageVersion = "1.4" //之前是1.1
	}
}
  1. 添加阿里云的仓库
	repositories {
		maven { url "https://maven.aliyun.com/repository/public" }
		maven { url "https://repo.spring.io/libs-release" }
		maven { url "https://repo.springsource.org/plugins-release" }
	}

  1. spring beans
    循环依赖的处理,修改spring-beans下的spring-beans.gradle,把之前的4行注释掉,添加下面的代码
// def deps = compileGroovy.taskDependencies.immutableValues + compileGroovy.taskDependencies.mutableValues
// compileGroovy.dependsOn = deps - "compileJava"
// compileKotlin.dependsOn(compileGroovy)
// compileKotlin.classpath += files(compileGroovy.destinationDir)

tasks.named('compileGroovy') {
	// Groovy only needs the declared dependencies (and not the result of Java compilation)
	classpath = sourceSets.main.compileClasspath
}
tasks.named('compileKotlin') {
	// Kotlin also depends on the result of Groovy compilation
	classpath += files(sourceSets.main.groovy.classesDirectory)

最后祝大家好运!!在学习的过程中遇到好的,还有解决的问题,还是会再贴出来,大家一些学习!!
success

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值