I encountered a problem when compiling the source code of the spring 5.2.x version. I am unable to determine whether it is a gradle issue or a source code issue. Please help.

I can confirm that there is no problem with the local environment variables.

macbookpro:spring-framework monk$ echo $GRADLE_USER_HOME
/Users/monk/repository/gradle
macbookpro:spring-framework monk$ echo $GRADLE_HOME
/Users/monk/soft/gradle-5.6.4
macbookpro:spring-framework monk$ gradle -v

------------------------------------------------------------
Gradle 5.6.4
------------------------------------------------------------

Build time:   2019-11-01 20:42:00 UTC
Revision:     dd870424f9bd8e195d614dc14bb140f43c22da98

Kotlin:       1.3.41
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM:          1.8.0_261 (Oracle Corporation 25.261-b12)
OS:           Mac OS X 10.16 x86_64

But when I run ./gradlew, the following exception occurs

macbookpro:spring-framework monk$ ./gradlew
Exception in thread "main" java.lang.RuntimeException: Base: GRADLE_USER_HOME  is unknown
    at org.gradle.wrapper.PathAssembler.getBaseDir(PathAssembler.java:97)
    at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:44)
    at org.gradle.wrapper.Install.createDist(Install.java:44)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)

I tried executing export GRADLE_USER_HOME=/Users/monk/repository/gradle first and then running ./gradlew in the same terminal session, but it still didn't work, with the same exception message.

Comment From: snicoll

Unfortunately, Spring Framework 5.2.x is out of OSS support, but the question above is Gradle-specifics so you may have more help on the appropriate Gradle support forum.