Spring-boot 2.3.x源碼基于Gradle編譯過程詳解
spring Boot源碼編譯
1. git上下拉最新版的spring Boot
下載:git clone git@github.com:spring-projects/spring-boot.git,建議下載release版本,不會出現奇奇怪怪的錯誤
2.修改下載源,
gradle\wrapper中的配置文件
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists #distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip //這里Gradle換成你自己存放gradle的路徑以及gradle的壓縮包名 //這里需要注意的是gradle版本問題,盡量高一點兒,就是用了gradle-4.9的版本,導致報錯gradle-api plugins問題,還缺包啥的,換了包之后就沒問題了 distributionUrl=file:///E:/Gitee_repository/Java_Sources_Code_Study/Spring-Boot-2.3.1/gradle-6.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists
buildSrc下的build.gradle
plugins { id "java-gradle-plugin" //可能是原有的編譯環(huán)境,注釋掉,否則報錯 //id "io.spring.javaformat" version "${javaFormatVersion}" id "checkstyle" } repositories { maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url "https://repo.spring.io/plugins-release" } mavenCentral() gradlePluginPortal() maven { url "https://repo.spring.io/release" } } sourceCompatibility = 1.8 targetCompatibility = 1.8 .......
settings.gradle
pluginManagement { repositories { maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url "https://repo.spring.io/plugins-release" } mavenCentral() gradlePluginPortal() } resolutionStrategy { eachPlugin { if (requested.id.id == "io.spring.javaformat") { useModule "io.spring.javaformat:spring-javaformat-gradle-plugin:${requested.version}" } } } }
gradle.properties
javaFormatVersion=0.0.22 #新增如下配置,解決heap堆內存空間不夠問題 gradlePropertiesProp=gradlePropertiesValue sysProp=shouldBeOverWrittenBySysProp systemProp.system=systemValue org.gradle.caching=false org.gradle.jvmargs=-Xms2048m -Xmx4096m org.gradle.parallel=true org.gradle.daemon=true org.gradle.configureondemand=true
根目錄下的build.gradle
// 放在第一行 buildscript { repositories { maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url "https://repo.spring.io/plugins-release" } } } allprojects { group "org.springframework.boot" repositories { maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' } mavenCentral() if (!version.endsWith('RELEASE')) { maven { url "https://repo.spring.io/milestone" } } if (version.endsWith('BUILD-SNAPSHOT')) { maven { url "https://repo.spring.io/snapshot" } } } configurations.all { resolutionStrategy.cacheChangingModulesFor 60, "minutes" } }
seetings.gradle
pluginManagement { repositories { maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' } mavenCentral() gradlePluginPortal() maven { url 'https://repo.spring.io/plugins-release' } if (version.endsWith('BUILD-SNAPSHOT')) { maven { url "https://repo.spring.io/snapshot" } } } resolutionStrategy { eachPlugin { if (requested.id.id == "org.jetbrains.kotlin.jvm") { useVersion "${kotlinVersion}" } if (requested.id.id == "org.jetbrains.kotlin.plugin.spring") { useVersion "${kotlinVersion}" } } } }
2. idea導入
在編譯的時候點擊取消,配置idea
3.開始編譯
至此撒花編譯成功!
不過后面還有好長時間的檢測,不知道是什么鬼??
到此這篇關于Spring-boot 2.3.x源碼基于Gradle編譯過程詳解的文章就介紹到這了,更多相關Spring-boot 2.3.x源碼內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
- springboot2.3 整合mybatis-plus 高級功能及用法詳解
- springboot2.3 整合mybatis-plus 高級功能(圖文詳解)
- Spring Boot2.3 新特性分層JAR的使用
- SpringBoot2.3新特性優(yōu)雅停機詳解
- IDEA 2020.2 +Gradle 6.6.1 + Spring Boot 2.3.4 創(chuàng)建多模塊項目的超詳細教程
- springboot-2.3.x最新版源碼閱讀環(huán)境搭建(基于gradle構建)
- Spring Boot配置Thymeleaf(gradle)的簡單使用
- springboot+gradle 構建多模塊項目的步驟
- Spring Boot Gradle發(fā)布war到tomcat的方法示例
相關文章
使用stream的Collectors.toMap()方法常見的問題及解決
這篇文章主要介紹了使用stream的Collectors.toMap()方法常見的問題及解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-03-03SpringBoot實現連接nacos并支持多環(huán)境部署
這篇文章主要介紹了SpringBoot實現連接nacos并支持多環(huán)境部署方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-06-06Springboot中的異步任務執(zhí)行及監(jiān)控詳解
這篇文章主要介紹了Springboot中的異步任務執(zhí)行及監(jiān)控詳解,除了自己實現線程外,springboot本身就提供了通過注解的方式,進行異步任務的執(zhí)行,下面主要記錄一下,在Springboot項目中實現異步任務,以及對異步任務進行封裝監(jiān)控,需要的朋友可以參考下2023-10-10詳解關于IntelliJ IDEA中Schedule for Addition 的問題
本篇文章主要介紹了詳解關于 IntelliJ IDEA 中 Schedule for Addition 的問題,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-12-12