@@ -696,6 +696,15 @@ subprojects {
696696
697697 task docsJar(dependsOn : javadocJar)
698698
699+ // Consumed by root aggregatedJavadoc; mirrors compileClasspath.
700+ configurations {
701+ javadocClasspathElements {
702+ canBeConsumed = true
703+ canBeResolved = false
704+ extendsFrom configurations. compileClasspath
705+ }
706+ }
707+
699708 check. dependsOn(' javadoc' )
700709
701710 task systemTestLibs(dependsOn : jar)
@@ -3991,12 +4000,34 @@ project(':connect:test-plugins') {
39914000 }
39924001}
39934002
3994- task aggregatedJavadoc (type : Javadoc , dependsOn : compileJava) {
4003+ // Gradle 9+ forbids resolving a subproject's Configuration from the root.
4004+ // Consume each subproject's javadocClasspathElements via project dependencies instead.
4005+ configurations {
4006+ aggregatedJavadocClasspath {
4007+ canBeConsumed = false
4008+ canBeResolved = true
4009+ }
4010+ }
4011+
4012+ task aggregatedJavadoc (type : Javadoc ) {
4013+ destinationDir = file(" ${ layout.buildDirectory.get().asFile.path} /docs/javadoc" )
4014+ }
4015+
4016+ gradle. projectsEvaluated {
39954017 def projectsWithJavadoc = subprojects. findAll { it. javadoc. enabled }
3996- source = projectsWithJavadoc. collect { it. sourceSets. main. allJava }
3997- classpath = files(projectsWithJavadoc. collect { it. sourceSets. main. compileClasspath })
3998- includes = projectsWithJavadoc. collectMany { it. javadoc. getIncludes() }
3999- excludes = projectsWithJavadoc. collectMany { it. javadoc. getExcludes() }
4018+
4019+ projectsWithJavadoc. each { sp ->
4020+ dependencies. add(' aggregatedJavadocClasspath' ,
4021+ dependencies. project(path : sp. path, configuration : ' javadocClasspathElements' ))
4022+ }
4023+
4024+ tasks. named(' aggregatedJavadoc' ). configure {
4025+ dependsOn projectsWithJavadoc. collect { " ${ it.path} :compileJava" }
4026+ source projectsWithJavadoc. collect { it. sourceSets. main. allJava }
4027+ classpath = configurations. aggregatedJavadocClasspath
4028+ includes = projectsWithJavadoc. collectMany { it. javadoc. getIncludes() }
4029+ excludes = projectsWithJavadoc. collectMany { it. javadoc. getExcludes() }
4030+ }
40004031}
40014032
40024033
0 commit comments