怎么快速构建spring源码

Posted by hang.li on November 19, 2022

github加速

  1. 使用gitee克隆github中的仓库,然后使用gitee克隆(不推荐, 如果需要和github保持一致需要一直复制)
  2. 下载油猴插件, 安装链接脚本, url img.png

spring-framework

  1. 克隆代码到本地, github
  2. gradle可以指定gradle版本编译,最好下载源工程指定的版本
  3. 可修改maven仓库,找到目录下settings.gradle,在原有的基础上添加阿里仓库
    1
    2
    3
    4
    5
    6
    7
    
    pluginManagement {
     repositories {
         maven { url "https://maven.aliyun.com/repository/public" }
         maven { url "https://maven.aliyun.com/repository/jcenter" }
         maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
         maven { url "https://maven.aliyun.com/repository/central" }
         ...
    
  4. 找到根路径下的import-into-idea.md文件
  5. 按照步骤操作 ```java Within your locally cloned spring-framework working directory:

  6. Precompile spring-oxm with ./gradlew :spring-oxm:compileTestJava

    在window当前目录运行

    ./gradlew.bat :spring-oxm:compileTestJava

  7. Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle)

    使用idea导入当前项目

  8. When prompted exclude the spring-aspects module (or after the import via File-> Project Structure -> Modules)

    排除spring-aspects模块

  9. Code away

    编译整个工程

    ./gradlew.bat ```

    spring-boot

    • 修改maven仓库后直接用idea打开构建即可