Gradle 编译Spring Framework v5.2.7.RELEASE 导入IntelliJIdea

it2026-01-01  0

Gradle 编译Spring Framework v5.2.7.RELEASE 导入IntelliJIdea

版本

Gradle 5.6.4 Spring Framework 5.2.7.RELEASE Idea: 2020.2 Windows 10家庭

下载地址

Spring官方:https://github.com/spring-projects/spring-framework Gradle:https://gradle.org/releases/ gitee地址:https://gitee.com/wangxuwen/spring-framework 注:github下载慢的,可尝试备份地址(他人提供,感谢)

背景

为了解Spring Framework源码,故下载尝试。

开始

下载spring-framework git clone https://gitee.com/wangxuwen/spring-framework.git 下载gradle https://gradle.org/releases/(可省略)进入已下载的spring-framework文件夹中,找到gradle\wrapper\gradle-wrapper.properties,注释掉远程的gradle版本。该步骤,因下载远程下载较慢。 #distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip distributionUrl=file:///C:/E/tools/dev/gradle-5.6.4-bin.zip 找到build.gradle 在其中的仓库中,添加本地和aliyun的仓库地址 repositories { mavenLocal() maven { url 'https://maven.aliyun.com/repository/public' } } 在spring-framework根目录下,执行 git checkout v5.2.7.RELEASE

切换到5.2.7.RELEASE版本。

在根目录下,以此执行 ./gradlew :spring-oxm:compileTestJava ./gradlew :spring-core:compileTestJava 根据官方文档,执行导入 https://github.com/spring-projects/spring-framework/blob/master/import-into-idea.md

问题

在spring-framework的master下,其要求的gradle版本是6.5,尝试多次都build失败。查询百度,bing,stackflow没有找到具体问题,故降级版本到5.2.7,根据该版本的gradle要求,提供5.6.4。 在第6步执行的两次build成功。

参考

https://github.com/spring-projects/spring-framework 指导如何导入Idea:https://github.com/spring-projects/spring-framework/blob/master/import-into-idea.md https://gitee.com/wangxuwen/spring-framework https://zhuanlan.zhihu.com/p/113739286 https://gradle.org/releases/ https://www.cnblogs.com/garfieldcgf/p/12591157.html https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings https://www.cnblogs.com/pansidong/p/11331457.html 阿里云新仓库地址:https://maven.aliyun.com/mvn/guide

感谢他人分享知识和开源项目。

最新回复(0)