06. 基于Gradle搭建Spring环境

Posted IT BOY

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了06. 基于Gradle搭建Spring环境相关的知识,希望对你有一定的参考价值。

目录

06 基于Gradle搭建Spring环境

Pt1 资源准备

Pt1.1 安装Gradle

Pt1.2 IDEA配置

Pt1.3 导入源码

Pt2 构建源码

Pt2.1 Gradle Build

Pt2.2 Idea Build Project

Pt3 验证

Pt4 采坑分享

Pt4.1 IDEA和Gradle版本不匹配

Pt4.2 多余的插件

Pt4.3 程序包jdk.jfr不存在


06 基于Gradle搭建Spring环境

Pt1 资源准备

  • IntelliJ IDEA 2020.3.2 (Ultimate Edition)

  • Java version "11.0.10" 2021-01-19 LTS

  • Gradle 6.5

  • Spring 5.3.0-SNAPSHOT

 


Pt1.1 安装Gradle

(1) 下载Gradle

官网:https://gradle.org/releases/

推荐使用gradle4以上的版本,否则不知道是否会有别的兼容性问题。我这边是按照Spring5源码gradle-wrapper.properties中依赖的gradle,选了个相近的版本,gradle-6.5。

 

(2) 配置环境变量

gradle安装比较简单,将gradle目录配置到环境变量即可。

 

(3) 检测gradle环境

通过gradle -v 检测gradle是否正确安装。

 C:\\Users\\tracy.chen>gradle -v
 ------------------------------------------------------------
 Gradle 6.5
 ------------------------------------------------------------
 ​
 Build time:   2020-06-02 20:46:21 UTC
 Revision:     a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
 ​
 Kotlin:       1.3.72
 Groovy:       2.5.11
 Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
 JVM:          1.8.0_92 (Oracle Corporation 25.92-b14)
 OS:           Windows 10 10.0 amd64

 


Pt1.2 IDEA配置

 

 


Pt1.3 导入源码

(1) Idea中选择[File]-[New]-[Project from Existing Sources],将源码导入IDEA;

 

(2) 添加阿里云镜像仓库

默认使用的是spring的仓库,由于网络限制,建议再build.gradle中配置国内的阿里提供的镜像仓库下载,下载速度会快很多。

 repositories {
     mavenCentral()
     maven { url "https://repo.spring.io/libs-spring-framework-build" }
     maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local" }
     maven {url 'https://maven.aliyun.com/nexus/content/groups/public/'} // 加上阿里云仓库
     maven {url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'} // 加上阿里云仓库
 }

 

(3) 修改依赖的gradle版本

gradle-wrapper.properties中描述了依赖的gradle版本,如果跟本地不一致,建议修改成一致的,防止出现意外的兼容性问题。

同时,如果本地安装的Gradle版本和Spring源码中依赖的版本相差太多,也建议本地升级到差不多的版本,防止出现意外的兼容性问题。

 distributionUrl=https\\://services.gradle.org/distributions/gradle-6.5-bin.zip

 

(4) 注释enterprise依赖

将io.spring.gradle-enterprise-conventions这个插件注释掉,否则编译阶段可能会报错。

这行代码可能在build.gradle文件中,也可能在settings.gradle文件中,我的是在settings.gradle中。

 //id "io.spring.gradle-enterprise-conventions" version "0.0.2"

 


Pt2 构建源码

Pt2.1 Gradle Build

使用gradle进行编译,我这边大概花了2个小时才完成编译,要下载大量的jar,最后当你看到BUILD SUCCESSFUL的时候,恭喜你终于成功了。

 > Task :buildSrc:compileJava UP-TO-DATE
 > Task :buildSrc:compileGroovy NO-SOURCE
 > Task :buildSrc:pluginDescriptors UP-TO-DATE
 > Task :buildSrc:processResources UP-TO-DATE
 > Task :buildSrc:classes UP-TO-DATE
 > Task :buildSrc:jar UP-TO-DATE
 > Task :buildSrc:generateSourceRoots UP-TO-DATE
 > Task :buildSrc:assemble UP-TO-DATE
 > Task :buildSrc:pluginUnderTestMetadata UP-TO-DATE
 > Task :buildSrc:compileTestJava NO-SOURCE
 > Task :buildSrc:compileTestGroovy NO-SOURCE
 > Task :buildSrc:processTestResources NO-SOURCE
 > Task :buildSrc:testClasses UP-TO-DATE
 > Task :buildSrc:test SKIPPED
 > Task :buildSrc:validatePlugins UP-TO-DATE
 > Task :buildSrc:check SKIPPED
 > Task :buildSrc:build UP-TO-DATE
 ​
 Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
 Use '--warning-mode all' to show the individual deprecation warnings.
 See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
 ​
 BUILD SUCCESSFUL in 44s
 ​
 BUILD SUCCESSFUL in 374ms

 


Pt2.2 Idea Build Project

(1) 选择IDEA - [Build Project]

如果直接编译成功,恭喜你,绝对哪里不正常。

如果出现[Kotlin: warnings found and -Werror specified]这个错误,那说明你基本上快搞定了。

 

(2) 编译spring-core

  • 打开IDEA右侧Gradle标签页,双击[spring-core]-[Tasks]-[other]-[cglibRepackJar],看到[BUILD SUCCESSFUL]才说明成功;

  • 然后双击[spring-core]-[other]-[objenesisRepackJar],直到[BUILD SUCCESSFUL];

  • 然后双击[spring-core]-[other]-[compileTestJava],直到[BUILD SUCCESSFUL];

  • 最后双击[spring-core]-[build]-[build],直到[BUILD SUCCESSFUL];

 

(3) 编译spring-framework

双击[spring]-[Tasks]-[build]-[build]进行编译,看到Build成功。

 13:24:56: Executing task 'build'...
 ​
 > Task :buildSrc:compileJava UP-TO-DATE
 > Task :buildSrc:compileGroovy NO-SOURCE
 > Task :buildSrc:pluginDescriptors UP-TO-DATE
 > Task :buildSrc:processResources UP-TO-DATE
 > Task :buildSrc:classes UP-TO-DATE
 > Task :buildSrc:jar UP-TO-DATE
 > Task :buildSrc:assemble UP-TO-DATE
 > Task :buildSrc:pluginUnderTestMetadata UP-TO-DATE
 > Task :buildSrc:compileTestJava NO-SOURCE
 > Task :buildSrc:compileTestGroovy NO-SOURCE
 > Task :buildSrc:processTestResources NO-SOURCE
 > Task :buildSrc:testClasses UP-TO-DATE
 > Task :buildSrc:test NO-SOURCE
 > Task :buildSrc:validatePlugins UP-TO-DATE
 > Task :buildSrc:check UP-TO-DATE
 > Task :buildSrc:build UP-TO-DATE
 > Task :framework-bom:assemble UP-TO-DATE
 > Task :integration-tests:compileJava NO-SOURCE
 > Task :framework-bom:check UP-TO-DATE
 > Task :framework-bom:build UP-TO-DATE
 > Task :integration-tests:processResources NO-SOURCE
 > Task :integration-tests:classes UP-TO-DATE
 > Task :compileKotlin NO-SOURCE
 > Task :spring-core:cglibRepackJar UP-TO-DATE
 > Task :compileJava NO-SOURCE
 > Task :compileGroovy NO-SOURCE
 > Task :processResources NO-SOURCE
 > Task :classes UP-TO-DATE
 > Task :inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-core:objenesisRepackJar UP-TO-DATE
 > Task :jar UP-TO-DATE
 > Task :assemble UP-TO-DATE
 > Task :checkstyleMain NO-SOURCE
 > Task :integration-tests:jar UP-TO-DATE
 > Task :integration-tests:assemble UP-TO-DATE
 > Task :integration-tests:checkstyleMain NO-SOURCE
 > Task :integration-tests:compileTestFixturesJava NO-SOURCE
 > Task :spring-core:processResources UP-TO-DATE
 > Task :spring-beans:processResources UP-TO-DATE
 > Task :spring-aop:processResources UP-TO-DATE
 > Task :spring-expression:processResources UP-TO-DATE
 > Task :spring-jcl:compileJava UP-TO-DATE
 > Task :spring-jcl:processResources UP-TO-DATE
 > Task :spring-jcl:classes UP-TO-DATE
 > Task :kotlin-coroutines:compileKotlin UP-TO-DATE
 > Task :spring-jcl:jar UP-TO-DATE
 > Task :kotlin-coroutines:compileJava NO-SOURCE
 > Task :kotlin-coroutines:processResources NO-SOURCE
 > Task :kotlin-coroutines:classes UP-TO-DATE
 > Task :kotlin-coroutines:inspectClassesForKotlinIC UP-TO-DATE
 > Task :kotlin-coroutines:jar UP-TO-DATE
 > Task :spring-context:processResources UP-TO-DATE
 > Task :spring-instrument:compileJava UP-TO-DATE
 > Task :spring-instrument:processResources NO-SOURCE
 > Task :spring-instrument:classes UP-TO-DATE
 > Task :spring-tx:processResources UP-TO-DATE
 > Task :spring-instrument:jar UP-TO-DATE
 > Task :spring-oxm:processResources UP-TO-DATE
 > Task :spring-jdbc:processResources UP-TO-DATE
 > Task :spring-orm:processResources NO-SOURCE
 > Task :spring-context-support:processResources UP-TO-DATE
 > Task :spring-web:processResources UP-TO-DATE
 > Task :spring-webmvc:processResources UP-TO-DATE
 > Task :spring-messaging:processResources NO-SOURCE
 > Task :spring-websocket:processResources UP-TO-DATE
 > Task :spring-webflux:processResources UP-TO-DATE
 > Task :spring-test:processResources UP-TO-DATE
 > Task :spring-aop:processTestFixturesResources NO-SOURCE
 > Task :spring-beans:processTestFixturesResources NO-SOURCE
 > Task :spring-tx:processTestFixturesResources NO-SOURCE
 > Task :kotlin-coroutines:assemble UP-TO-DATE
 > Task :integration-tests:processTestResources UP-TO-DATE
 > Task :integration-tests:processTestFixturesResources NO-SOURCE
 > Task :integration-tests:testFixturesClasses UP-TO-DATE
 > Task :integration-tests:checkstyleTestFixtures NO-SOURCE
 > Task :kotlin-coroutines:checkstyleMain NO-SOURCE
 > Task :kotlin-coroutines:compileTestFixturesKotlin NO-SOURCE
 > Task :kotlin-coroutines:compileTestFixturesJava NO-SOURCE
 > Task :kotlin-coroutines:compileTestKotlin NO-SOURCE
 > Task :integration-tests:testFixturesJar UP-TO-DATE
 > Task :kotlin-coroutines:compileTestJava NO-SOURCE
 > Task :kotlin-coroutines:processTestResources NO-SOURCE
 > Task :kotlin-coroutines:testClasses UP-TO-DATE
 > Task :kotlin-coroutines:checkstyleTest NO-SOURCE
 > Task :kotlin-coroutines:processTestFixturesResources NO-SOURCE
 > Task :kotlin-coroutines:testFixturesClasses UP-TO-DATE
 > Task :spring-aop:processTestResources UP-TO-DATE
 > Task :spring-aop:processJmhResources NO-SOURCE
 > Task :kotlin-coroutines:checkstyleTestFixtures NO-SOURCE
 > Task :spring-aspects:processResources UP-TO-DATE
 > Task :kotlin-coroutines:testFixturesJar UP-TO-DATE
 > Task :spring-aspects:processTestResources UP-TO-DATE
 > Task :spring-aspects:processJmhResources NO-SOURCE
 > Task :spring-aspects:processTestFixturesResources NO-SOURCE
 > Task :spring-context:processTestFixturesResources NO-SOURCE
 > Task :spring-context-support:processTestFixturesResources NO-SOURCE
 > Task :spring-beans:processTestResources UP-TO-DATE
 > Task :spring-beans:processJmhResources UP-TO-DATE
 > Task :spring-core:compileKotlin UP-TO-DATE
 > Task :kotlin-coroutines:test NO-SOURCE
 > Task :kotlin-coroutines:check UP-TO-DATE
 > Task :kotlin-coroutines:build UP-TO-DATE
 > Task :spring-context-indexer:compileJava UP-TO-DATE
 > Task :spring-context:processTestResources UP-TO-DATE
 > Task :spring-context:processJmhResources NO-SOURCE
 > Task :spring-core:compileJava UP-TO-DATE
 > Task :spring-core:classes UP-TO-DATE
 > Task :spring-context-support:processTestResources UP-TO-DATE
 > Task :spring-context-support:processJmhResources NO-SOURCE
 > Task :spring-core:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-expression:processTestResources UP-TO-DATE
 > Task :spring-expression:processJmhResources NO-SOURCE
 > Task :spring-expression:processTestFixturesResources NO-SOURCE
 > Task :spring-instrument:assemble UP-TO-DATE
 > Task :spring-instrument:compileTestFixturesJava NO-SOURCE
 > Task :spring-instrument:compileTestJava NO-SOURCE
 > Task :spring-core:jar UP-TO-DATE
 > Task :spring-instrument:processTestResources NO-SOURCE
 > Task :spring-core:compileTestFixturesKotlin UP-TO-DATE
 > Task :spring-core:compileTestFixturesJava UP-TO-DATE
 > Task :spring-expression:compileKotlin UP-TO-DATE
 > Task :spring-expression:compileJava UP-TO-DATE
 > Task :spring-expression:classes UP-TO-DATE
 > Task :spring-expression:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-expression:jar UP-TO-DATE
 > Task :spring-core:processTestFixturesResources NO-SOURCE
 > Task :spring-core:testFixturesClasses UP-TO-DATE
 > Task :spring-core:testFixturesJar UP-TO-DATE
 > Task :spring-core:assemble UP-TO-DATE
 > Task :spring-core:compileTestKotlin UP-TO-DATE
 > Task :spring-core:compileTestJava UP-TO-DATE
 > Task :spring-core:processTestResources UP-TO-DATE
 > Task :spring-core:testClasses UP-TO-DATE
 > Task :spring-core:compileJmhKotlin UP-TO-DATE
 > Task :spring-core:compileJmhJava UP-TO-DATE
 > Task :spring-core:processJmhResources NO-SOURCE
 > Task :spring-core:jmhClasses UP-TO-DATE
 > Task :spring-context-indexer:processResources UP-TO-DATE
 > Task :spring-context-indexer:classes UP-TO-DATE
 > Task :spring-context-indexer:jar UP-TO-DATE
 > Task :spring-context-indexer:assemble UP-TO-DATE
 > Task :spring-context-indexer:compileTestFixturesJava NO-SOURCE
 > Task :spring-context-indexer:processTestResources NO-SOURCE
 > Task :spring-context-indexer:processJmhResources NO-SOURCE
 > Task :checkstyleNohttp UP-TO-DATE
 > Task :compileTestFixturesKotlin NO-SOURCE
 > Task :spring-core:checkstyleJmh UP-TO-DATE
 > Task :compileTestFixturesJava NO-SOURCE
 > Task :compileTestFixturesGroovy NO-SOURCE
 > Task :processTestFixturesResources NO-SOURCE
 > Task :testFixturesClasses UP-TO-DATE
 > Task :testFixturesJar UP-TO-DATE
 > Task :compileTestKotlin NO-SOURCE
 > Task :compileTestJava NO-SOURCE
 > Task :spring-core:checkstyleMain UP-TO-DATE
 > Task :compileTestGroovy NO-SOURCE
 > Task :processTestResources NO-SOURCE
 > Task :testClasses UP-TO-DATE
 > Task :checkstyleTest NO-SOURCE
 > Task :checkstyleTestFixtures NO-SOURCE
 > Task :spring-core:checkstyleTest UP-TO-DATE
 > Task :spring-core:checkstyleTestFixtures UP-TO-DATE
 > Task :spring-beans:compileGroovy UP-TO-DATE
 > Task :test NO-SOURCE
 > Task :check UP-TO-DATE
 > Task :build UP-TO-DATE
 > Task :spring-expression:assemble UP-TO-DATE
 > Task :spring-expression:compileTestFixturesKotlin NO-SOURCE
 > Task :spring-beans:compileKotlin UP-TO-DATE
 > Task :spring-expression:compileTestFixturesJava NO-SOURCE
 > Task :spring-beans:compileJava NO-SOURCE
 > Task :spring-beans:classes UP-TO-DATE
 > Task :spring-beans:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-context-indexer:checkstyleMain UP-TO-DATE
 > Task :spring-context-indexer:processTestFixturesResources NO-SOURCE
 > Task :spring-context-indexer:testFixturesClasses UP-TO-DATE
 > Task :spring-context-indexer:checkstyleTestFixtures NO-SOURCE
 > Task :spring-context-indexer:testFixturesJar UP-TO-DATE
 > Task :spring-instrument:testClasses UP-TO-DATE
 > Task :spring-core:test UP-TO-DATE
 > Task :spring-beans:jar UP-TO-DATE
 > Task :spring-instrument:compileJmhJava NO-SOURCE
 > Task :spring-beans:compileTestFixturesKotlin UP-TO-DATE
 > Task :spring-beans:compileTestFixturesJava UP-TO-DATE
 > Task :spring-beans:compileTestFixturesGroovy NO-SOURCE
 > Task :spring-beans:testFixturesClasses UP-TO-DATE
 > Task :spring-expression:compileTestKotlin UP-TO-DATE
 > Task :spring-core:check UP-TO-DATE
 > Task :spring-core:build UP-TO-DATE
 > Task :spring-beans:testFixturesJar UP-TO-DATE
 > Task :spring-beans:assemble UP-TO-DATE
 > Task :spring-expression:compileTestJava UP-TO-DATE
 > Task :spring-expression:testClasses UP-TO-DATE
 > Task :spring-aop:compileJava UP-TO-DATE
 > Task :spring-aop:classes UP-TO-DATE
 > Task :spring-aop:jar UP-TO-DATE
 > Task :spring-expression:compileJmhKotlin UP-TO-DATE
 > Task :spring-oxm:compileJava UP-TO-DATE
 > Task :spring-oxm:classes UP-TO-DATE
 > Task :spring-oxm:jar UP-TO-DATE
 > Task :spring-beans:compileTestKotlin UP-TO-DATE
 > Task :spring-aop:compileTestFixturesJava UP-TO-DATE
 > Task :spring-aop:testFixturesClasses UP-TO-DATE
 > Task :spring-aop:testFixturesJar UP-TO-DATE
 > Task :spring-aop:assemble UP-TO-DATE
 > Task :spring-expression:compileJmhJava UP-TO-DATE
 > Task :spring-expression:jmhClasses UP-TO-DATE
 > Task :spring-beans:compileTestJava UP-TO-DATE
 > Task :spring-beans:compileTestGroovy NO-SOURCE
 > Task :spring-beans:testClasses UP-TO-DATE
 > Task :spring-aop:compileTestJava UP-TO-DATE
 > Task :spring-aop:testClasses UP-TO-DATE
 > Task :spring-aop:compileJmhJava NO-SOURCE
 > Task :spring-aop:jmhClasses UP-TO-DATE
 > Task :spring-beans:compileJmhKotlin UP-TO-DATE
 > Task :spring-aop:checkstyleJmh NO-SOURCE
 > Task :spring-expression:checkstyleJmh UP-TO-DATE
 > Task :spring-beans:compileJmhJava UP-TO-DATE
 > Task :spring-expression:checkstyleMain UP-TO-DATE
 > Task :spring-beans:compileJmhGroovy NO-SOURCE
 > Task :spring-beans:jmhClasses UP-TO-DATE
 > Task :spring-expression:checkstyleTest UP-TO-DATE
 > Task :spring-expression:testFixturesClasses UP-TO-DATE
 > Task :spring-expression:checkstyleTestFixtures NO-SOURCE
 > Task :spring-expression:testFixturesJar UP-TO-DATE
 > Task :spring-aop:checkstyleMain UP-TO-DATE
 > Task :spring-aop:checkstyleTest UP-TO-DATE
 > Task :spring-expression:test UP-TO-DATE
 > Task :spring-expression:check UP-TO-DATE
 > Task :spring-expression:build UP-TO-DATE
 > Task :spring-aop:checkstyleTestFixtures UP-TO-DATE
 > Task :spring-context:compileKotlin UP-TO-DATE
 > Task :spring-instrument:processJmhResources NO-SOURCE
 > Task :spring-instrument:jmhClasses UP-TO-DATE
 > Task :spring-instrument:checkstyleJmh NO-SOURCE
 > Task :spring-beans:checkstyleJmh UP-TO-DATE
 > Task :spring-beans:checkstyleMain UP-TO-DATE
 > Task :spring-beans:checkstyleTest UP-TO-DATE
 > Task :spring-beans:checkstyleTestFixtures UP-TO-DATE
 > Task :spring-context:compileJava UP-TO-DATE
 > Task :spring-aop:test UP-TO-DATE
 > Task :spring-aop:check UP-TO-DATE
 > Task :spring-aop:build UP-TO-DATE
 > Task :spring-context:compileGroovy NO-SOURCE
 > Task :spring-jcl:assemble UP-TO-DATE
 > Task :spring-context:classes UP-TO-DATE
 > Task :spring-jcl:compileTestFixturesJava NO-SOURCE
 > Task :spring-context:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-jcl:compileTestJava NO-SOURCE
 > Task :spring-jcl:processTestResources NO-SOURCE
 > Task :spring-jcl:testClasses UP-TO-DATE
 > Task :spring-context:jar UP-TO-DATE
 > Task :spring-jcl:compileJmhJava NO-SOURCE
 > Task :spring-instrument:checkstyleMain UP-TO-DATE
 > Task :spring-beans:test UP-TO-DATE
 > Task :spring-context:compileTestFixturesKotlin UP-TO-DATE
 > Task :spring-context:compileTestFixturesJava UP-TO-DATE
 > Task :spring-context:compileTestFixturesGroovy NO-SOURCE
 > Task :spring-context:testFixturesClasses UP-TO-DATE
 > Task :spring-context:testFixturesJar UP-TO-DATE
 > Task :spring-tx:compileKotlin UP-TO-DATE
 > Task :spring-tx:compileJava UP-TO-DATE
 > Task :spring-tx:classes UP-TO-DATE
 > Task :spring-tx:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-tx:jar UP-TO-DATE
 > Task :spring-jdbc:compileKotlin UP-TO-DATE
 > Task :spring-jdbc:compileJava UP-TO-DATE
 > Task :spring-jdbc:classes UP-TO-DATE
 > Task :spring-jdbc:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-jdbc:jar UP-TO-DATE
 > Task :spring-context-support:compileJava UP-TO-DATE
 > Task :spring-context-support:classes UP-TO-DATE
 > Task :spring-tx:compileTestFixturesKotlin UP-TO-DATE
 > Task :spring-context-support:jar UP-TO-DATE
 > Task :spring-tx:compileTestFixturesJava UP-TO-DATE
 > Task :spring-tx:testFixturesClasses UP-TO-DATE
 > Task :spring-tx:testFixturesJar UP-TO-DATE
 > Task :spring-beans:check UP-TO-DATE
 > Task :spring-beans:build UP-TO-DATE
 > Task :spring-context:assemble UP-TO-DATE
 > Task :spring-context-support:compileTestFixturesJava UP-TO-DATE
 > Task :spring-context-support:testFixturesClasses UP-TO-DATE
 > Task :spring-context-support:testFixturesJar UP-TO-DATE
 > Task :spring-context:compileTestKotlin UP-TO-DATE
 > Task :spring-context-indexer:compileTestJava UP-TO-DATE
 > Task :spring-context-indexer:testClasses UP-TO-DATE
 > Task :spring-context-indexer:compileJmhJava NO-SOURCE
 > Task :spring-context-indexer:jmhClasses UP-TO-DATE
 > Task :spring-context-indexer:checkstyleJmh NO-SOURCE
 > Task :spring-context-indexer:checkstyleTest UP-TO-DATE
 > Task :spring-context:compileTestJava UP-TO-DATE
 > Task :spring-context:compileTestGroovy UP-TO-DATE
 > Task :spring-context:testClasses UP-TO-DATE
 > Task :spring-context-indexer:test UP-TO-DATE
 > Task :spring-context-indexer:check UP-TO-DATE
 > Task :spring-context-indexer:build UP-TO-DATE
 > Task :spring-context-support:assemble UP-TO-DATE
 > Task :spring-messaging:compileKotlin UP-TO-DATE
 > Task :spring-context:compileJmhKotlin UP-TO-DATE
 > Task :spring-web:compileKotlin UP-TO-DATE
 > Task :spring-messaging:compileJava UP-TO-DATE
 > Task :spring-messaging:classes UP-TO-DATE
 > Task :spring-messaging:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-messaging:jar UP-TO-DATE
 > Task :spring-instrument:checkstyleTest NO-SOURCE
 > Task :spring-instrument:processTestFixturesResources NO-SOURCE
 > Task :spring-instrument:testFixturesClasses UP-TO-DATE
 > Task :spring-instrument:checkstyleTestFixtures NO-SOURCE
 > Task :spring-instrument:testFixturesJar UP-TO-DATE
 > Task :spring-web:compileJava UP-TO-DATE
 > Task :spring-web:classes UP-TO-DATE
 > Task :spring-web:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-context:compileJmhJava UP-TO-DATE
 > Task :spring-context:compileJmhGroovy NO-SOURCE
 > Task :spring-context:jmhClasses UP-TO-DATE
 > Task :spring-web:jar UP-TO-DATE
 > Task :spring-context-support:compileTestJava UP-TO-DATE
 > Task :spring-instrument:test NO-SOURCE
 > Task :spring-context:checkstyleJmh UP-TO-DATE
 > Task :spring-context:checkstyleMain UP-TO-DATE
 > Task :spring-context:checkstyleTest UP-TO-DATE
 > Task :spring-context:checkstyleTestFixtures UP-TO-DATE
 > Task :spring-orm:compileJava UP-TO-DATE
 > Task :spring-orm:classes UP-TO-DATE
 > Task :spring-orm:jar UP-TO-DATE
 > Task :spring-aspects:compileJava NO-SOURCE
 > Task :spring-context:test UP-TO-DATE
 > Task :spring-context:check UP-TO-DATE
 > Task :spring-context:build UP-TO-DATE
 > Task :spring-context-support:testClasses UP-TO-DATE
 > Task :spring-context-support:compileJmhJava NO-SOURCE
 > Task :spring-context-support:jmhClasses UP-TO-DATE
 > Task :spring-context-support:checkstyleJmh NO-SOURCE
 > Task :spring-aspects:compileAspectj UP-TO-DATE
 > Task :spring-aspects:classes UP-TO-DATE
 > Task :spring-aspects:jar UP-TO-DATE
 > Task :spring-aspects:assemble UP-TO-DATE
 > Task :spring-aspects:compileTestFixturesJava NO-SOURCE
 > Task :spring-aspects:compileTestFixturesAspectj NO-SOURCE
 > Task :spring-context-support:checkstyleMain UP-TO-DATE
 > Task :spring-context-support:checkstyleTest UP-TO-DATE
 > Task :spring-context-support:checkstyleTestFixtures UP-TO-DATE
 > Task :spring-aspects:checkstyleMain UP-TO-DATE
 > Task :spring-aspects:testFixturesClasses UP-TO-DATE
 > Task :spring-aspects:checkstyleTestFixtures NO-SOURCE
 > Task :spring-aspects:testFixturesJar UP-TO-DATE
 > Task :spring-instrument:check UP-TO-DATE
 > Task :spring-instrument:build UP-TO-DATE
 > Task :spring-jcl:processJmhResources NO-SOURCE
 > Task :spring-jcl:jmhClasses UP-TO-DATE
 > Task :spring-jcl:checkstyleJmh NO-SOURCE
 > Task :spring-context-support:test UP-TO-DATE
 > Task :spring-context-support:check UP-TO-DATE
 > Task :spring-context-support:build UP-TO-DATE
 > Task :spring-jdbc:assemble UP-TO-DATE
 > Task :spring-jdbc:compileTestFixturesKotlin NO-SOURCE
 > Task :spring-jdbc:compileTestFixturesJava NO-SOURCE
 > Task :spring-webflux:compileKotlin UP-TO-DATE
 > Task :spring-webflux:compileJava UP-TO-DATE
 > Task :spring-webflux:classes UP-TO-DATE
 > Task :spring-jcl:checkstyleMain UP-TO-DATE
 > Task :spring-jcl:checkstyleTest NO-SOURCE
 > Task :spring-jcl:processTestFixturesResources NO-SOURCE
 > Task :spring-jcl:testFixturesClasses UP-TO-DATE
 > Task :spring-webmvc:compileKotlin UP-TO-DATE
 > Task :spring-jcl:checkstyleTestFixtures NO-SOURCE
 > Task :spring-webflux:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-jcl:testFixturesJar UP-TO-DATE
 > Task :spring-webflux:jar UP-TO-DATE
 > Task :spring-webmvc:compileJava UP-TO-DATE
 > Task :spring-webmvc:classes UP-TO-DATE
 > Task :spring-jdbc:compileTestKotlin UP-TO-DATE
 > Task :spring-webmvc:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-webmvc:jar UP-TO-DATE
 > Task :spring-jdbc:compileTestJava UP-TO-DATE
 > Task :spring-jdbc:processTestResources UP-TO-DATE
 > Task :spring-jdbc:testClasses UP-TO-DATE
 > Task :spring-jdbc:compileJmhKotlin NO-SOURCE
 > Task :spring-jdbc:compileJmhJava NO-SOURCE
 > Task :spring-jdbc:processJmhResources NO-SOURCE
 > Task :spring-jdbc:jmhClasses UP-TO-DATE
 > Task :spring-jdbc:checkstyleJmh NO-SOURCE
 > Task :spring-jcl:test NO-SOURCE
 > Task :spring-jcl:check UP-TO-DATE
 > Task :spring-jcl:build UP-TO-DATE
 > Task :spring-messaging:assemble UP-TO-DATE
 > Task :spring-jms:compileJava UP-TO-DATE
 > Task :spring-messaging:compileTestFixturesKotlin NO-SOURCE
 > Task :spring-messaging:compileTestFixturesJava NO-SOURCE
 > Task :spring-jms:processResources UP-TO-DATE
 > Task :spring-jms:classes UP-TO-DATE
 > Task :spring-jms:jar UP-TO-DATE
 > Task :spring-jms:assemble UP-TO-DATE
 > Task :spring-jms:compileTestFixturesJava NO-SOURCE
 > Task :spring-jdbc:checkstyleMain UP-TO-DATE
 > Task :spring-jdbc:checkstyleTest UP-TO-DATE
 > Task :spring-jdbc:processTestFixturesResources NO-SOURCE
 > Task :spring-jdbc:testFixturesClasses UP-TO-DATE
 > Task :spring-jdbc:checkstyleTestFixtures NO-SOURCE
 > Task :spring-jms:compileTestJava UP-TO-DATE
 > Task :spring-jdbc:testFixturesJar UP-TO-DATE
 > Task :spring-jms:processTestResources UP-TO-DATE
 > Task :spring-jms:testClasses UP-TO-DATE
 > Task :spring-jms:compileJmhJava NO-SOURCE
 > Task :spring-jms:processJmhResources NO-SOURCE
 > Task :spring-jms:jmhClasses UP-TO-DATE
 > Task :spring-jms:checkstyleJmh NO-SOURCE
 > Task :spring-jdbc:test UP-TO-DATE
 > Task :spring-jdbc:check UP-TO-DATE
 > Task :spring-jdbc:build UP-TO-DATE
 > Task :spring-orm:assemble UP-TO-DATE
 > Task :spring-orm:compileTestFixturesJava NO-SOURCE
 > Task :spring-websocket:compileJava UP-TO-DATE
 > Task :spring-websocket:classes UP-TO-DATE
 > Task :spring-websocket:jar UP-TO-DATE
 > Task :spring-jms:checkstyleMain UP-TO-DATE
 > Task :spring-jms:checkstyleTest UP-TO-DATE
 > Task :spring-jms:processTestFixturesResources NO-SOURCE
 > Task :spring-jms:testFixturesClasses UP-TO-DATE
 > Task :spring-web:compileTestFixturesKotlin UP-TO-DATE
 > Task :spring-jms:checkstyleTestFixtures NO-SOURCE
 > Task :spring-jms:testFixturesJar UP-TO-DATE
 > Task :spring-messaging:compileTestKotlin UP-TO-DATE
 > Task :spring-web:compileTestFixturesJava UP-TO-DATE
 > Task :spring-messaging:compileTestJava UP-TO-DATE
 > Task :spring-messaging:processTestResources UP-TO-DATE
 > Task :spring-messaging:testClasses UP-TO-DATE
 > Task :spring-jms:test UP-TO-DATE
 > Task :spring-jms:check UP-TO-DATE
 > Task :spring-jms:build UP-TO-DATE
 > Task :spring-web:processTestFixturesResources UP-TO-DATE
 > Task :spring-web:testFixturesClasses UP-TO-DATE
 > Task :spring-web:testFixturesJar UP-TO-DATE
 > Task :spring-oxm:assemble UP-TO-DATE
 > Task :spring-oxm:compileTestFixturesJava NO-SOURCE
 > Task :spring-oxm:genJaxb UP-TO-DATE
 > Task :spring-messaging:compileJmhKotlin UP-TO-DATE
 > Task :spring-messaging:compileJmhJava UP-TO-DATE
 > Task :spring-messaging:processJmhResources NO-SOURCE
 > Task :spring-messaging:jmhClasses UP-TO-DATE
 > Task :spring-orm:compileTestJava UP-TO-DATE
 > Task :spring-orm:processTestResources UP-TO-DATE
 > Task :spring-orm:testClasses UP-TO-DATE
 > Task :spring-orm:compileJmhJava NO-SOURCE
 > Task :spring-orm:processJmhResources NO-SOURCE
 > Task :spring-orm:jmhClasses UP-TO-DATE
 > Task :spring-orm:checkstyleJmh NO-SOURCE
 > Task :spring-oxm:compileTestJava UP-TO-DATE
 > Task :spring-oxm:processTestResources UP-TO-DATE
 > Task :spring-oxm:testClasses UP-TO-DATE
 > Task :spring-oxm:compileJmhJava NO-SOURCE
 > Task :spring-oxm:processJmhResources NO-SOURCE
 > Task :spring-oxm:jmhClasses UP-TO-DATE
 > Task :spring-oxm:checkstyleJmh NO-SOURCE
 > Task :spring-messaging:checkstyleJmh UP-TO-DATE
 > Task :spring-messaging:checkstyleMain UP-TO-DATE
 > Task :spring-messaging:checkstyleTest UP-TO-DATE
 > Task :spring-messaging:processTestFixturesResources NO-SOURCE
 > Task :spring-messaging:testFixturesClasses UP-TO-DATE
 > Task :spring-messaging:checkstyleTestFixtures NO-SOURCE
 > Task :spring-messaging:testFixturesJar UP-TO-DATE
 > Task :spring-orm:checkstyleMain UP-TO-DATE
 > Task :spring-orm:checkstyleTest UP-TO-DATE
 > Task :spring-orm:processTestFixturesResources NO-SOURCE
 > Task :spring-orm:testFixturesClasses UP-TO-DATE
 > Task :spring-orm:checkstyleTestFixtures NO-SOURCE
 > Task :spring-oxm:checkstyleMain UP-TO-DATE
 > Task :spring-oxm:checkstyleTest UP-TO-DATE
 > Task :spring-oxm:processTestFixturesResources NO-SOURCE
 > Task :spring-oxm:testFixturesClasses UP-TO-DATE
 > Task :spring-oxm:checkstyleTestFixtures NO-SOURCE
 > Task :spring-orm:testFixturesJar UP-TO-DATE
 > Task :spring-oxm:testFixturesJar UP-TO-DATE
 > Task :spring-orm:test UP-TO-DATE
 > Task :spring-orm:check UP-TO-DATE
 > Task :spring-orm:build UP-TO-DATE
 > Task :spring-messaging:test UP-TO-DATE
 > Task :spring-messaging:check UP-TO-DATE
 > Task :spring-messaging:build UP-TO-DATE
 > Task :spring-tx:assemble UP-TO-DATE
 > Task :spring-oxm:test UP-TO-DATE
 > Task :spring-oxm:check UP-TO-DATE
 > Task :spring-oxm:build UP-TO-DATE
 > Task :spring-web:assemble UP-TO-DATE
 > Task :spring-r2dbc:compileKotlin UP-TO-DATE
 > Task :spring-r2dbc:compileJava UP-TO-DATE
 > Task :spring-r2dbc:processResources UP-TO-DATE
 > Task :spring-r2dbc:classes UP-TO-DATE
 > Task :spring-r2dbc:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-r2dbc:jar UP-TO-DATE
 > Task :spring-r2dbc:assemble UP-TO-DATE
 > Task :spring-r2dbc:compileTestFixturesKotlin NO-SOURCE
 > Task :spring-r2dbc:compileTestFixturesJava NO-SOURCE
 > Task :spring-tx:compileTestKotlin UP-TO-DATE
 > Task :spring-tx:compileTestJava UP-TO-DATE
 > Task :spring-tx:processTestResources UP-TO-DATE
 > Task :spring-tx:testClasses UP-TO-DATE
 > Task :spring-web:compileTestKotlin UP-TO-DATE
 > Task :spring-test:compileKotlin UP-TO-DATE
 > Task :spring-tx:compileJmhKotlin NO-SOURCE
 > Task :spring-tx:compileJmhJava NO-SOURCE
 > Task :spring-tx:processJmhResources NO-SOURCE
 > Task :spring-tx:jmhClasses UP-TO-DATE
 > Task :spring-tx:checkstyleJmh NO-SOURCE
 > Task :spring-test:compileJava UP-TO-DATE
 > Task :spring-test:classes UP-TO-DATE
 > Task :spring-test:inspectClassesForKotlinIC UP-TO-DATE
 > Task :spring-web:compileTestJava UP-TO-DATE
 > Task :spring-r2dbc:compileTestKotlin UP-TO-DATE
 > Task :spring-r2dbc:compileTestJava UP-TO-DATE
 > Task :spring-web:processTestResources UP-TO-DATE
 > Task :spring-web:testClasses UP-TO-DATE
 > Task :spring-test:jar UP-TO-DATE
 > Task :spring-r2dbc:processTestResources UP-TO-DATE
 > Task :spring-aspects:compileTestJava NO-SOURCE
 > Task :spring-tx:checkstyleMain UP-TO-DATE
 > Task :spring-r2dbc:testClasses UP-TO-DATE
 > Task :spring-r2dbc:compileJmhKotlin NO-SOURCE
 > Task :spring-r2dbc:compileJmhJava NO-SOURCE
 > Task :spring-r2dbc:processJmhResources NO-SOURCE
 > Task :spring-r2dbc:jmhClasses UP-TO-DATE
 > Task :spring-r2dbc:checkstyleJmh NO-SOURCE
 > Task :spring-web:compileJmhKotlin UP-TO-DATE
 > Task :spring-test:assemble UP-TO-DATE
 > Task :spring-test:compileTestFixturesKotlin NO-SOURCE
 > Task :spring-test:compileTestFixturesJava NO-SOURCE
 > Task :spring-r2dbc:checkstyleMain UP-TO-DATE
 > Task :spring-r2dbc:checkstyleTest UP-TO-DATE
 > Task :spring-r2dbc:processTestFixturesResources NO-SOURCE
 > Task :spring-r2dbc:testFixturesClasses UP-TO-DATE
 > Task :spring-aspects:compileTestAspectj UP-TO-DATE
 > Task :spring-r2dbc:checkstyleTestFixtures NO-SOURCE
 > Task :spring-aspects:testClasses UP-TO-DATE
 > Task :spring-r2dbc:testFixturesJar UP-TO-DATE
 > Task :spring-aspects:compileJmhJava NO-SOURCE
 > Task :spring-aspects:compileJmhAspectj NO-SOURCE
 > Task :spring-aspects:jmhClasses UP-TO-DATE
 > Task :spring-aspects:checkstyleJmh NO-SOURCE
 > Task :spring-aspects:checkstyleTest UP-TO-DATE
 > Task :integration-tests:compileTestJava UP-TO-DATE
 > Task :integration-tests:testClasses UP-TO-DATE
 > Task :spring-r2dbc:test UP-TO-DATE
 > Task :spring-aspects:test UP-TO-DATE
 > Task :spring-aspects:check UP-TO-DATE
 > Task :spring-aspects:build UP-TO-DATE
 > Task :spring-r2dbc:check UP-TO-DATE
 > Task :spring-r2dbc:build UP-TO-DATE
 > Task :spring-tx:checkstyleTest UP-TO-DATE
 > Task :spring-web:compileJmhJava UP-TO-DATE
 > Task :spring-web:processJmhResources NO-SOURCE
 > Task :spring-web:jmhClasses UP-TO-DATE
 > Task :spring-tx:checkstyleTestFixtures UP-TO-DATE
 > Task :spring-tx:test UP-TO-DATE
 > Task :spring-tx:check UP-TO-DATE
 > Task :spring-tx:build UP-TO-DATE
 > Task :spring-webflux:assemble UP-TO-DATE
 > Task :spring-webflux:compileTestFixturesKotlin NO-SOURCE
 > Task :spring-webflux:compileTestFixturesJava NO-SOURCE
 > Task :integration-tests:checkstyleTest UP-TO-DATE
 > Task :spring-web:checkstyleJmh UP-TO-DATE
 > Task :spring-web:checkstyleMain UP-TO-DATE
 > Task :spring-web:checkstyleTest UP-TO-DATE
 > Task :spring-web:checkstyleTestFixtures UP-TO-DATE
 > Task :integration-tests:test UP-TO-DATE
 > Task :integration-tests:check UP-TO-DATE
 > Task :integration-tests:build UP-TO-DATE
 > Task :spring-webmvc:assemble UP-TO-DATE
 > Task :spring-webmvc:compileTestFixturesKotlin NO-SOURCE
 > Task :spring-webmvc:compileTestFixturesJava NO-SOURCE
 > Task :spring-test:compileTestKotlin UP-TO-DATE
 > Task :spring-web:test UP-TO-DATE
 > Task :spring-web:check UP-TO-DATE
 > Task :spring-web:build UP-TO-DATE
 > Task :spring-websocket:assemble UP-TO-DATE
 > Task :spring-websocket:compileTestFixturesJava NO-SOURCE
 > Task :spring-webflux:compileTestKotlin UP-TO-DATE
 > Task :spring-test:compileTestJava UP-TO-DATE
 > Task :spring-webflux:compileTestJava UP-TO-DATE
 > Task :spring-webflux:processTestResources UP-TO-DATE
 > Task :spring-test:processTestResources UP-TO-DATE
 > Task :spring-test:testClasses UP-TO-DATE
 > Task :spring-test:processTestFixturesResources NO-SOURCE
 > Task :spring-test:testFixturesClasses UP-TO-DATE
 > Task :spring-test:testFixturesJar UP-TO-DATE
 > Task :spring-webflux:testClasses UP-TO-DATE
 > Task :spring-webflux:compileJmhKotlin NO-SOURCE
 > Task :spring-webflux:compileJmhJava NO-SOURCE
 > Task :spring-webflux:processJmhResources NO-SOURCE
 > Task :spring-webflux:jmhClasses UP-TO-DATE
 > Task :spring-webflux:checkstyleJmh NO-SOURCE
 > Task :spring-webmvc:compileTestKotlin UP-TO-DATE
 > Task :spring-webflux:checkstyleMain UP-TO-DATE
 > Task :spring-webmvc:compileTestJava UP-TO-DATE
 > Task :spring-websocket:compileTestJava UP-TO-DATE
 > Task :spring-websocket:processTestResources UP-TO-DATE
 > Task :spring-websocket:testClasses UP-TO-DATE
 > Task :spring-webflux:checkstyleTest UP-TO-DATE
 > Task :spring-webflux:processTestFixturesResources NO-SOURCE
 > Task :spring-webflux:testFixturesClasses UP-TO-DATE
 > Task :spring-webflux:checkstyleTestFixtures NO-SOURCE
 > Task :spring-websocket:compileJmhJava NO-SOURCE
 > Task :spring-websocket:processJmhResources NO-SOURCE
 > Task :spring-websocket:jmhClasses UP-TO-DATE
 > Task :spring-websocket:checkstyleJmh NO-SOURCE
 > Task :spring-webflux:testFixturesJar UP-TO-DATE
 > Task :spring-test:junit UP-TO-DATE
 > Task :spring-webmvc:processTestResources UP-TO-DATE
 > Task :spring-webmvc:testClasses UP-TO-DATE
 > Task :spring-webmvc:compileJmhKotlin NO-SOURCE
 > Task :spring-webmvc:compileJmhJava NO-SOURCE
 > Task :spring-webmvc:processJmhResources NO-SOURCE
 > Task :spring-webmvc:jmhClasses UP-TO-DATE
 > Task :spring-webmvc:checkstyleJmh NO-SOURCE
 > Task :spring-webmvc:checkstyleMain UP-TO-DATE
 > Task :spring-websocket:checkstyleMain UP-TO-DATE
 > Task :spring-websocket:checkstyleTest UP-TO-DATE
 > Task :spring-websocket:processTestFixturesResources NO-SOURCE
 > Task :spring-webmvc:checkstyleTest UP-TO-DATE
 > Task :spring-websocket:testFixturesClasses UP-TO-DATE
 > Task :spring-webmvc:processTestFixturesResources NO-SOURCE
 > Task :spring-webmvc:testFixturesClasses UP-TO-DATE
 > Task :spring-websocket:checkstyleTestFixtures NO-SOURCE
 > Task :spring-webmvc:checkstyleTestFixtures NO-SOURCE
 > Task :spring-webmvc:testFixturesJar UP-TO-DATE
 > Task :spring-websocket:testFixturesJar UP-TO-DATE
 > Task :spring-test:testNG UP-TO-DATE
 > Task :spring-test:aggregateTestReports UP-TO-DATE
 > Task :spring-test:compileJmhKotlin NO-SOURCE
 > Task :spring-test:compileJmhJava NO-SOURCE
 > Task :spring-test:processJmhResources NO-SOURCE
 > Task :spring-test:jmhClasses UP-TO-DATE
 > Task :spring-test:checkstyleJmh NO-SOURCE
 > Task :spring-websocket:test UP-TO-DATE
 > Task :spring-websocket:check UP-TO-DATE
 > Task :spring-websocket:build UP-TO-DATE
 > Task :spring-webflux:test UP-TO-DATE
 > Task :spring-webflux:check UP-TO-DATE
 > Task :spring-webflux:build UP-TO-DATE
 > Task :spring-test:checkstyleMain UP-TO-DATE
 > Task :spring-test:checkstyleTest UP-TO-DATE
 > Task :spring-test:checkstyleTestFixtures NO-SOURCE
 > Task :spring-webmvc:test UP-TO-DATE
 > Task :spring-webmvc:check UP-TO-DATE
 > Task :spring-webmvc:build UP-TO-DATE
 > Task :spring-test:test NO-SOURCE
 > Task :spring-test:check UP-TO-DATE
 > Task :spring-test:build UP-TO-DATE
 ​
 Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
 Use '--warning-mode all' to show the individual deprecation warnings.
 See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
 ​
 BUILD SUCCESSFUL in 25s
 281 actionable tasks: 281 up-to-date
 13:25:22: Task execution finished 'build'.

 


Pt3 验证

打开ApplicationContext.java类,右键-Diagrams-Show Dependencies,如果成功说明源码导入成功。

 


Pt4 采坑分享

上面的流程看起来比较简单,但我实际上花了差不多2-3天才真正编译成功,中间遇到过很多的错误。我把我遇到的错误,和解决办法列出来,以供参考。

 

Pt4.1 IDEA和Gradle版本不匹配

错误描述如下。

 java.lang.AbstractMethodError: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;
     at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultCachePolicy.mustRefreshModule(DefaultCachePolicy.java:177)
     at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultCachePolicy.mustRefreshModule(DefaultCachePolicy.java:163)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveComponentMetaDataFromCache(CachingModuleComponentRepository.java:216)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveComponentMetaData(CachingModuleComponentRepository.java:189)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.lambda$resolveComponentMetaData$5(ErrorHandlingModuleComponentRepository.java:154)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.lambda$tryResolveAndMaybeBlacklist$18(ErrorHandlingModuleComponentRepository.java:223)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.tryResolveAndMaybeBlacklist(ErrorHandlingModuleComponentRepository.java:237)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.tryResolveAndMaybeBlacklist(ErrorHandlingModuleComponentRepository.java:222)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.performOperationWithRetries(ErrorHandlingModuleComponentRepository.java:215)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveComponentMetaData(ErrorHandlingModuleComponentRepository.java:153)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentMetaDataResolveState.process(ComponentMetaDataResolveState.java:69)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentMetaDataResolveState.resolve(ComponentMetaDataResolveState.java:48)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.findBestMatch(RepositoryChainComponentMetaDataResolver.java:138)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.findBestMatch(RepositoryChainComponentMetaDataResolver.java:119)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:93)
     at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolve(RepositoryChainComponentMetaDataResolver.java:64)
     at org.gradle.api.internal.artifacts.query.DefaultArtifactResolutionQuery.buildComponentResult(DefaultArtifactResolutionQuery.java:173)
     at org.gradle.api.internal.artifacts.query.DefaultArtifactResolutionQuery.createResult(DefaultArtifactResolutionQuery.java:151)
     at org.gradle.api.internal.artifacts.query.DefaultArtifactResolutionQuery.execute(DefaultArtifactResolutionQuery.java:142)
     at org.jetbrains.plugins.gradle.tooling.util.DependencyResolverImpl.resolveDependencies(DependencyResolverImpl.java:207)
     at org.jetbrains.plugins.gradle.tooling.util.DependencyResolverImpl.resolveDependencies(DependencyResolverImpl.java:125)
     at org.jetbrains.kotlin.gradle.KotlinMPPGradleModelBuilder.buildDependencies(KotlinMPPGradleModelBuilder.kt:141)
     at org.jetbrains.kotlin.gradle.KotlinMPPGradleModelBuilder.buildSourceSetDependencies(KotlinMPPGradleModelBuilder.kt:259)
     at org.jetbrains.kotlin.gradle.KotlinMPPGradleModelBuilder.buildSourceSet(KotlinMPPGradleModelBuilder.kt:98)
     at org.jetbrains.kotlin.gradle.KotlinMPPGradleModelBuilder.buildSourceSets(KotlinMPPGradleModelBuilder.kt:82)
     at org.jetbrains.kotlin.gradle.KotlinMPPGradleModelBuilder.buildAll(KotlinMPPGradleModelBuilder.kt:48)
     at org.jetbrains.plugins.gradle.tooling.internal.ExtraModelBuilder.buildAll(ExtraModelBuilder.java:67)
     at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingToolingModelBuilder$1$1.create(DefaultToolingModelBuilderRegistry.java:105)
     at org.gradle.api.internal.project.DefaultProjectStateRegistry.withLenientState(DefaultProjectStateRegistry.java:134)
     at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingToolingModelBuilder$1.call(DefaultToolingModelBuilderRegistry.java:101)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
     at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
     at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingToolingModelBuilder.buildAll(DefaultToolingModelBuilderRegistry.java:98)
     at org.gradle.tooling.internal.provider.runner.DefaultBuildController.getModel(DefaultBuildController.java:82)
     at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter$2.getModel(InternalBuildActionAdapter.java:77)
     at org.gradle.tooling.internal.consumer.connection.BuildControllerAdapter.getModel(BuildControllerAdapter.java:62)
     at org.gradle.tooling.internal.consumer.connection.AbstractBuildController.findModel(AbstractBuildController.java:57)
     at org.gradle.tooling.internal.consumer.connection.AbstractBuildController.findModel(AbstractBuildController.java:44)
     at org.jetbrains.plugins.gradle.model.ProjectImportAction.addExtraProject(ProjectImportAction.java:134)
     at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:76)
     at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:40)
     at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter.execute(InternalBuildActionAdapter.java:80)
     at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner$ResultBuildingListener.buildResult(ClientProvidedBuildActionRunner.java:114)
     at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner$ResultBuildingListener.buildFinished(ClientProvidedBuildActionRunner.java:106)
     at sun.reflect.GeneratedMethodAccessor441.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:498)
     at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
     at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
     at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:398)
     at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:380)
     at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
     at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:368)
     at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:355)
     at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
     at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:245)
     at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:157)
     at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
     at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:346)
     at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:249)
     at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:141)
     at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
     at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
     at com.sun.proxy.$Proxy18.buildFinished(Unknown Source)
     at org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:185)
     at org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:127)
     at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:75)
     at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:67)
     at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:180)
     at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
     at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:67)
     at org.gradle.internal.invocation.GradleBuildController.configure(GradleBuildController.java:61)
     at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:57)
     at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
     at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
     at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:63)
     at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
     at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
     at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:51)
     at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:45)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
     at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
     at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
     at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
     at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:50)
     at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
     at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:80)
     at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
     at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
     at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
     at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
     at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:87)
     at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:55)
     at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:60)
     at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:38)
     at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
     at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
     at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
     at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
     at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
     at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
     at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:56)
     at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:42)
     at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
     at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
     at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:68)
     at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
     at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
     at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
     at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
     at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
     at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
     at org.gradle.util.Swapper.swap(Swapper.java:38)
     at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
     at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
     at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
     at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
     at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
     at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
     at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
     at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
     at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
     at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
     at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
     at java.lang.Thread.run(Thread.java:745)

 

第一个典型的错误是这个,而且我觉得也是最坑的,没有想到IDEA和Gradle之间还有版本兼容性问题。因为我开始用的是[IDEA2018.1] + [Gradle4.9],一直失败,我怀疑是Gradle问题,然后将Gradle升级到6.5版本就一直报这个错,从错误原因上来根本看不出任何东西,就感觉不是代码问题是Gradle问题。

后来查到,Gradle版本如果超过5,就需要IDEA2018.3以上版本来支持,然后我直接升级到了[IDEA 2020.3.2]版本,果然没有再出现过这个错误。

这个错误大概整整搞了我2天时间,没有头绪,很多网上资料就说可能是网络差,多编译几次就可以,其实根本不是。

 


Pt4.2 多余的插件

解决了上面的问题后,编译一直报错,是关于io.spring.gradle-enterprise-conventions插件的,最后直接注释了settings.gradle中插件的依赖,解决问题。

 //id "io.spring.gradle-enterprise-conventions" version "0.0.2"

 


Pt4.3 程序包jdk.jfr不存在

对项目整体进行编译,发现有报错了,提示包找不到。

 D:\\work\\workspace_new\\github\\spring-framework\\spring-core\\src\\main\\java\\org\\springframework\\core\\metrics\\jfr\\FlightRecorderStartupEvent.java:19:15
 java: 程序包jdk.jfr不存在

研究了下,说是这个包在jdk9或以上版本才有,我本地还是jdk8,升级到jdk11,解决问题。

 


我相信按照这套方案,你依然会出现其他问题,不同版本,不同环境的差异都会导致很多奇怪的问题,重要的是遇到问题要善于分析,然后解决问题。

 

 

 

 

 

 

以上是关于06. 基于Gradle搭建Spring环境的主要内容,如果未能解决你的问题,请参考以下文章

SPRING01_基于gradle7.4.2和JDK17搭建Spring源码坏境

SPRING01_基于gradle7.4.2和JDK17搭建Spring源码坏境

SPRING01_基于gradle6.8.2和JDK15搭建Spring源码坏境

超详细图解!基于IDEA+Gradle+jdk11搭建Spring框架源码阅读环境

超详细图解!教小白学妹基于IDEA+Gradle+jdk11搭建Spring框架源码阅读环境

spring5 源码深度解析-----Spring的整体架构和环境搭建