Spring-boot 2.3.x源碼基于Gradle編譯過(guò)程詳解
spring Boot源碼編譯
1. git上下拉最新版的spring Boot
下載:git clone git@github.com:spring-projects/spring-boot.git,建議下載release版本,不會(huì)出現(xiàn)奇奇怪怪的錯(cuò)誤
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版本問(wèn)題,盡量高一點(diǎn)兒,就是用了gradle-4.9的版本,導(dǎo)致報(bào)錯(cuò)gradle-api plugins問(wèn)題,還缺包啥的,換了包之后就沒(méi)問(wèn)題了 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)境,注釋掉,否則報(bào)錯(cuò) //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堆內(nèi)存空間不夠問(wèn)題 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導(dǎo)入
在編譯的時(shí)候點(diǎn)擊取消,配置idea
3.開(kāi)始編譯
至此撒花編譯成功!
不過(guò)后面還有好長(zhǎng)時(shí)間的檢測(cè),不知道是什么鬼??
到此這篇關(guān)于Spring-boot 2.3.x源碼基于Gradle編譯過(guò)程詳解的文章就介紹到這了,更多相關(guān)Spring-boot 2.3.x源碼內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- springboot2.3 整合mybatis-plus 高級(jí)功能及用法詳解
- springboot2.3 整合mybatis-plus 高級(jí)功能(圖文詳解)
- Spring Boot2.3 新特性分層JAR的使用
- SpringBoot2.3新特性?xún)?yōu)雅停機(jī)詳解
- IDEA 2020.2 +Gradle 6.6.1 + Spring Boot 2.3.4 創(chuàng)建多模塊項(xiàng)目的超詳細(xì)教程
- springboot-2.3.x最新版源碼閱讀環(huán)境搭建(基于gradle構(gòu)建)
- Spring Boot配置Thymeleaf(gradle)的簡(jiǎn)單使用
- springboot+gradle 構(gòu)建多模塊項(xiàng)目的步驟
- Spring Boot Gradle發(fā)布war到tomcat的方法示例
相關(guān)文章
使用stream的Collectors.toMap()方法常見(jiàn)的問(wèn)題及解決
這篇文章主要介紹了使用stream的Collectors.toMap()方法常見(jiàn)的問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-03-03MyBatis中${}?和?#{}?有什么區(qū)別小結(jié)
${}?和?#{}?都是?MyBatis?中用來(lái)替換參數(shù)的,它們都可以將用戶(hù)傳遞過(guò)來(lái)的參數(shù),替換到?MyBatis?最終生成的?SQL?中,但它們區(qū)別卻是很大的,今天通過(guò)本文介紹下MyBatis中${}?和?#{}?有什么區(qū)別,感興趣的朋友跟隨小編一起看看吧2022-11-11Java線程通信中關(guān)于生產(chǎn)者與消費(fèi)者案例分析
這篇文章主要介紹了Java線程通信中關(guān)于生產(chǎn)者與消費(fèi)者案例,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-09-09Java數(shù)組與堆棧相關(guān)知識(shí)總結(jié)
今天給大家?guī)?lái)的是關(guān)于Java的相關(guān)知識(shí),文章圍繞著Java數(shù)組與堆棧展開(kāi),文中有非常詳細(xì)的介紹及代碼示例,需要的朋友可以參考下2021-06-06JavaWeb利用struts實(shí)現(xiàn)文件下載時(shí)改變文件名稱(chēng)
這篇文章主要為大家詳細(xì)介紹了JavaWeb利用struts實(shí)現(xiàn)文件下載時(shí)改變文件名稱(chēng)的相關(guān)資料,需要的朋友可以參考下2016-06-06SpringBoot實(shí)現(xiàn)連接nacos并支持多環(huán)境部署
這篇文章主要介紹了SpringBoot實(shí)現(xiàn)連接nacos并支持多環(huán)境部署方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-06-06關(guān)于spring循環(huán)依賴(lài)問(wèn)題及解決方案
這篇文章主要介紹了關(guān)于spring循環(huán)依賴(lài)問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-06-06Springboot中的異步任務(wù)執(zhí)行及監(jiān)控詳解
這篇文章主要介紹了Springboot中的異步任務(wù)執(zhí)行及監(jiān)控詳解,除了自己實(shí)現(xiàn)線程外,springboot本身就提供了通過(guò)注解的方式,進(jìn)行異步任務(wù)的執(zhí)行,下面主要記錄一下,在Springboot項(xiàng)目中實(shí)現(xiàn)異步任務(wù),以及對(duì)異步任務(wù)進(jìn)行封裝監(jiān)控,需要的朋友可以參考下2023-10-10詳解關(guān)于IntelliJ IDEA中Schedule for Addition 的問(wèn)題
本篇文章主要介紹了詳解關(guān)于 IntelliJ IDEA 中 Schedule for Addition 的問(wèn)題,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-12-12