spring源代码下载

github上spring源代码地址:https://github.com/spring-pro...,间接从该我的项目上下载源代码

git clone https://github.com/spring-projects/spring-framework.git

这个地址下载是十分慢,有可能还会中途失败,这里通知个小技巧,对于github上热门的我的项目,咱们都能够在其镜像站中查找并下载:https://hub.fastgit.org

操作也非常简单,将上述命令中的(github.com替换为hub.fastgit.org),命令如下:

git clone https://hub.fastgit.org/spring-projects/spring-framework.git

切换分支

切换到release分支,依据须要切换到本人想学习的分支,本文是以5.2.x版本为例。

cd spring-frameworkgit checkout -b 5.2.x origin/5.2.x

环境筹备

jdk8

gradle工具,下载地址:https://gradle.org/releases/

源代码导入idea

file -> open -> 找到下载的spring-framework目录下的build.gradle

留神:要对idea的工具进行如下设置

本文应用的grade-6.6.1版本,导入时,会呈现如下报错:

Caused by: com.gradle.scan.plugin.BuildScanException: The build scan plugin is not compatible with Gradle 6.0 and later.Please use the Gradle Enterprise plugin instead.    at com.gradle.scan.plugin.BuildScanPlugin.a(SourceFile:99)

从报错中能够看到,是代码中的局部配置不反对Gradle6.0以上版本,在这里能够看到如何解决问题:https://docs.gradle.com/enter...

在settings.gradle中增加如下代码:

plugins { id "com.gradle.enterprise" version "3.5"}

删除build.gradle中删除如下代码:

id 'com.gradle.build-scan' version '3.2'

再次reload gradle project,又会呈现如下谬误:

Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'variants' for object of typeorg.gradle.api.plugins.internal.DefaultAdhocSoftwareComponent.

gradle/spring-moudle.gradle正文掉如下代码

// Once we upgrade to Gradle 6.x, we will need to delete the following line ...// components.java.variants.removeAll { it.outgoingConfiguration.name.startsWith("testFixtures") }

再次 reload gradle project,依据网络状况,缓缓期待编译实现,首次编译要半小时的样子。

BUILD SUCCESSFUL