spring5.x.x源码编译完后,spring-beans项目运行compileTestJava报循环依赖错误

 错误: 

Circular dependency between the following tasks:
:spring-beans:compileGroovy
\--- :spring-beans:compileJava
     \--- :spring-beans:compileKotlin
          \--- :spring-beans:compileGroovy (*)

 

网上看到有spring-beans.gradle 3行都加注释: 

def deps = compileGroovy.taskDependencies.immutableValues + compileGroovy.taskDependencies.mutableValues

compileGroovy.dependsOn = deps - "compileJava"

compileKotlin.dependsOn(compileGroovy)

 

又会报错/spring-beans/src/main/kotlin/org/springframework/beans/factory/ListableBeanFactoryExtensions.kt: (67, 37): Unresolved reference: ListableBeanFactory

 spring-beans.gradle need add this code:

// 从master分支copy的代码
tasks.named('compileGroovy') {
// Groovy only needs the declared dependencies (and not the result of Java compilation)
classpath = sourceSets.main.compileClasspath
}
tasks.named('compileKotlin') {
// Kotlin also depends on the result of Groovy compilation
classpath += files(sourceSets.main.groovy.classesDirectory)
}

then compileTestJava, we will build success.

 

Reference: https://bbs.csdn.net/topics/394784880

上一篇:依赖引起的错误


下一篇:手动配置S2SH三大框架报错(三)