compile spring 5.x in idea

prepare

  1. source code spring5.x
  2. gradle 4.9
  3. jdk1.8_131
  4. ideaIC-2019.1.1.exe (IntelliJ IDEA Community Edition 2019.1.1 x64)

Download source code in:
https://github.com/spring-projects/spring-framework/tree/5.0.x
Download gradle in:
https://gradle.org/releases/
Download idea in:
https://www.jetbrains.com/idea/download/
Download jdk in oracle website

the versions of these things are important

  • gradle version should bigger than 4.2 and no big than 5.0
    i use 4.6/ 5.1/ 5.4 gradle compile project failed.
  • jdk version should in 1.8, and no bigger than 1.8_131
    the blog of csdn editor has such experience.
  • idea version the newer the better, i use idea 2017.1.2 failed in junit test.

install

JAVA_HOME: D:\jdk1.8.0_131
CLASSPATH: .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;

GRADLE_HOME: D:\gradle-4.6
GRADLE_USER_HOME: D:.gradle

Add to path

at setting of idea, set sdk/gradle path.
set gradle parameters -XX:MaxPermSize=1024m -Xmx1024m -XX:MaxHeapSize=1024m

20190429143526.png

compile

import source code of spring5.x, import as a gradle project.
wait for gradle solve project sync.

comment no use depend in spring-beans.gradle

1
//compileGroovy.dependsOn = compileGroovy.taskDependencies.values - "compileJava"

if meet dependency problem like this

1
2
3
Circular dependency between the following tasks:
...
...

add org.gradle.configureondemand = true in gradle.properties

test

project is ready :)

org.springframework.beans.factory.xml.BeanNameGenerationTests

https://blog.csdn.net/baomw/article/details/83956300
https://www.jianshu.com/p/d6e3ec44f99a