下载Gradle,然后配置运行环境就可以了,有一点要注意的是gradle使用的是Groovy语言,而这个语言依赖于java,因此你必须安装配置java环境。
首先下载gradle,我们直接到官网下载一个gradle版本的压缩包
然后就是配置环境变量了,点击我的电脑 - 右键选择属性 - 高级 - 环境变量 ,然后新建环境变量,变量名为:GRADLE_HOME, 值为gradle目录,这里是: D:\Program Files\gradle\gradle-4.1
编辑变量之后,选择path - 编辑,将%GRADLE_HOME%\bin添加进去
最后点击确定,保存设置就可以了。
验证安装
只需要使用powershell命令打开,输入
gradle -v
即可看到输出
导入idea
- File -> New -> Project from Existing Sources -> 找到选择spring-framework源码 -> 选择build.gradle
- 笔者的打开之后,idea配置gradle: File->setting->gradle
- gradle 仓库
- gradle 路径
idea 编译 项目 成功
Download https://services.gradle.org/distributions/gradle-5.6.4-bin.zip (93.9 MB)
Download https://services.gradle.org/distributions/gradle-5.6.4-bin.zip finished succeeded, took 11 m 55 s 120 ms
Starting Gradle Daemon...
Gradle Daemon started in 1 s 273 ms
> Task :buildSrc:compileJava
> Task :buildSrc:compileJava UP-TO-DATE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:pluginDescriptors UP-TO-DATE
> Task :buildSrc:processResources UP-TO-DATE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:jar UP-TO-DATE
> Task :buildSrc:assemble UP-TO-DATE
> Task :buildSrc:pluginUnderTestMetadata
> Task :buildSrc:compileTestJava NO-SOURCE
> Task :buildSrc:compileTestGroovy NO-SOURCE
> Task :buildSrc:processTestResources NO-SOURCE
> Task :buildSrc:testClasses UP-TO-DATE
> Task :buildSrc:test NO-SOURCE
> Task :buildSrc:validateTaskProperties UP-TO-DATE
> Task :buildSrc:check UP-TO-DATE
> Task :buildSrc:build UP-TO-DATE
POM relocation to an other version number is not fully supported in Gradle : xml-apis:xml-apis:2.0.2 relocated to xml-apis:xml-apis:1.0.b2.
Please update your dependency to directly use the correct version 'xml-apis:xml-apis:1.0.b2'.
Resolution will only pick dependencies of the relocated element. Artifacts and other metadata will be ignored.
BUILD SUCCESSFUL in 1h 15m 35s
BUILD SUCCESSFUL in 22s
参考: