环境搭建
Spring已经将源码从svn迁移到了GitHub。而且也改为基于Gradle的构建来构建项目,它取代了之前的Ant+Ivy系统,所以要构建Spring源码环境首先安装GitHub以及Gradle
源码导入
从git下载源码后,如下图,在项目目录下执行gradlew命令
D:\textwork\spring-framework>gradlew
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for de
tails
:buildSrc:compileJava NO-SOURCE
:buildSrc:compileGroovy UP-TO-DATE
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes UP-TO-DATE
:buildSrc:jar UP-TO-DATE
:buildSrc:assemble UP-TO-DATE
:buildSrc:compileTestJava NO-SOURCE
:buildSrc:compileTestGroovy NO-SOURCE
:buildSrc:processTestResources NO-SOURCE
:buildSrc:testClasses UP-TO-DATE
:buildSrc:test NO-SOURCE
:buildSrc:check UP-TO-DATE
:buildSrc:build UP-TO-DATE
:help
Welcome to Gradle 3.5.1.
To run a build, run gradlew <task> ...
To see a list of available tasks, run gradlew tasks
To see a list of command-line options, run gradlew --help
To see more detail about a task, run gradlew help --task <task>
BUILD SUCCESSFUL
Total time: 11.36 secs
D:\textwork\spring-framework>
正常编译成功,用Intellij IDEA 工具成功 导入项目;
我在编译源码时候遇到问题 :如下图
D:\textwork\spring-framework>gradlew
:buildSrc:compileJava NO-SOURCE
:buildSrc:compileGroovy UP-TO-DATE
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes UP-TO-DATE
:buildSrc:jar UP-TO-DATE
:buildSrc:assemble UP-TO-DATE
:buildSrc:compileTestJava NO-SOURCE
:buildSrc:compileTestGroovy NO-SOURCE
:buildSrc:processTestResources NO-SOURCE
:buildSrc:testClasses UP-TO-DATE
:buildSrc:test NO-SOURCE
:buildSrc:check UP-TO-DATE
:buildSrc:build UP-TO-DATE
Download https://dl.bintray.com/kotlin/kotlin-eap-1.1/org/jetbrains/kotlin/kotli
n-compiler-embeddable/1.1.4-eap-33/kotlin-compiler-embeddable-1.1.4-eap-33.jar
<-------------> 0% CONFIGURING
> root project > 960 KB/26.08 MB downloaded
> root project > 3.72 MB/26.08 MB downloaded
在编译时候引用kotlin-compiler-embeddable-1.1.4-eap-33.jar 这个包,我下载spring-framework 引用的是1.1.4版本,在更新编译过程中 这个包在gradle下载不下来,在配置文件build.gradle
// ext.kotlinVersion = '1.1.4-eap-33'
ext.kotlinVersion = '1.1.2'
把 版本更换下 就可以正常编译通过;