記一次IDEA搭建Spring源碼閱讀環境

環境:Windows10/11、IntelliJ IDEA2021.3、Java1.8

一、下載Gradle

https://services.gradle.org/distributions 下載gradle-7.3-bin.zip

image-20211125185708458

下載後解壓到你想要的目錄,打開所示目錄,新建init.gradle文件,配置內容如下,添加阿里雲私服,加快包下載速度

image-20211125190450013

allprojects {
    repositories {
        maven { url 'file:///E:/java/maven_repository'}
        mavenLocal()
        maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" }
        maven { name "Bstek" ; url "https://nexus.bsdn.org/content/groups/public/" }
        mavenCentral()
    }

    buildscript { 
        repositories { 
            maven { name "Alibaba" ; url 'https://maven.aliyun.com/repository/public' }
            maven { name "Bstek" ; url 'https://nexus.bsdn.org/content/groups/public/' }
            maven { name "M2" ; url 'https://plugins.gradle.org/m2/' }
        }
    }
}

二、配置環境變量

新建系統變量,變量名爲GRADLE_HOME,變量值爲Gradle安裝包所在目錄

image-20211125190003091

添加到PATH環境變量中

image-20211125190120293

新建GRADLE_USER_HOME,作爲Gradle倉庫目錄

image-20211125190317816

三、下載Spring源碼

到Spring Github倉庫,https://github.com/spring-projects/spring-framework,複製git地址https://github.com/spring-projects/spring-framework.git

打開IDEA,選擇如圖

image-20211125191311437

clone即可

image-20211125191403515

另外,IDEA的Gradle配置如下

image-20211125191618920

接下來等待下載依賴即可

image-20211125191847143

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章