1.下载Spring
spring3.x以后托管到github上,所以下载源码直接到github上去下载。
github地址:spring-framework
由于我编译的是最新的的版本 spring-framework-5.0.4.RELEASE
下载地址:
https://codeload.github.com/spring-projects/spring-framework/zip/v5.0.4.RELEAS
下载如下图:
2.下载Gradle编译
由于spring是采用Gradle编译,所以必须下载Gradle
下载地址 https://gradle.org/releases/
我下载的最新版本:https://gradle.org/next-steps/?version=4.6&format=bin
- 配置环境变量
添加:GRADLE_HOME
添加环境变量:Path:%GRADLE_HOME%\bin - 检测环境
gradle -v
------------------------------------------------------------
Gradle 4.6
------------------------------------------------------------
Build time: 2018-02-28 13:36:36 UTC
Revision: 8fa6ce7945b640e6168488e4417f9bb96e4ab46c
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_102 (Oracle Corporation 25.102-b14)
OS: Windows 10 10.0 amd64
3.编译
- cmd 切到:spring-framework-5.0.4.RELEASE 目录
运行 gradlew.bat
G:\spring-framework\ideaspring\spring-framework-5.0.4.RELEASE>gradlew.bat
> Task :help
Welcome to Gradle 4.4.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 in 6s
1 actionable task: 1 executed
- 导入idea
然后等待编译,编译时间有点长要有点耐心。
完成:
4.问题
- Error:(30, 0) No such property: values for class: org.gradle.api.internal.tasks.DefaultTaskDependency
Possible solutions: values
Open File(spring-beans\spring-beans.gradle )
点击:Open File 然后注释掉
//compileGroovy.dependsOn = compileGroovy.taskDependencies.values - ‘compileJava’