1. 程式人生 > >Spring5.0原始碼匯入IDEA

Spring5.0原始碼匯入IDEA

1.下載Spring

spring3.x以後託管到github上,所以下載原始碼直接到github上去下載。

下載如下圖: 
這裡寫圖片描述

2.下載Gradle編譯

由於spring是採用Gradle編譯,所以必須下載Gradle

  1. 配置環境變數 
      新增:GRADLE_HOME 
    這裡寫圖片描述 
     新增環境變數:Path:%GRADLE_HOME%\bin
  2. 檢測環境 
    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.編譯

  1. 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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  1. 匯入idea

這裡寫圖片描述

然後等待編譯,編譯時間有點長要有點耐心。 
完成: 
這裡寫圖片描述

4.問題

  1. 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’