idea导入spring5源码(gradle)

文章目录

  • idea导入spring5源码(gradle)
    • 导入
    • 出现问题
    • 解决方法
    • 原因
    • 测试

idea导入spring5源码(gradle)

注:草稿版,个人学习记录用,待完善

导入

导入,并设置gradle编译,gradle可到官网下载
idea导入spring5源码(gradle)_第1张图片

出现问题

导入的出现以下问题:

Error:(30, 0) No such property: values for class: org.gradle.api.internal.tasks.DefaultTaskDependency
Possible solutions: values
Open File(spring-beans\spring-beans.gradle )

解决方法

解决方法,点击:Open File 然后注释掉
//compileGroovy.dependsOn = compileGroovy.taskDependencies.values - ‘compileJava’

idea导入spring5源码(gradle)_第2张图片
出现以下错误
idea导入spring5源码(gradle)_第3张图片

原因

主要是缺少objenesis这个包

package org.springframework.objenesis;

打开spring-core.gradle文件,点task objenesisRepackJar左边的小三角
idea导入spring5源码(gradle)_第4张图片
点Run,得到以下结果,问题成功解决

7:20:35: Executing task ‘objenesisRepackJar’…

Task :buildSrc:compileJava NO-SOURCE
Task :buildSrc:compileGroovy 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: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:check UP-TO-DATE
Task :buildSrc:build UP-TO-DATE
Task :spring-core:objenesisRepackJar UP-TO-DATE
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See
https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 2s
1 actionable task: 1 up-to-date
7:20:38: Task execution finished ‘objenesisRepackJar’.

cglib同样会出现这个问题,解决方法相同
idea导入spring5源码(gradle)_第5张图片

测试

idea导入spring5源码(gradle)_第6张图片

测试通过(Assume问题对结果无影响,可忽略)
idea导入spring5源码(gradle)_第7张图片

你可能感兴趣的:(spring)