This is an automated email from the ASF dual-hosted git repository.
mimaison pushed a commit to branch 4.3
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/4.3 by this push:
new dd5061a7d50 KAFKA-20542 : Fix aggregatedJavadocs build failure (#22172)
dd5061a7d50 is described below
commit dd5061a7d50fca0692f0840bbb3791000c6a3cbe
Author: Murali Basani <[email protected]>
AuthorDate: Wed Apr 29 20:26:05 2026 +0200
KAFKA-20542 : Fix aggregatedJavadocs build failure (#22172)
Reviewers: Mickael Maison <[email protected]>, Ming-Yen Chung
<[email protected]>
---
build.gradle | 41 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/build.gradle b/build.gradle
index 5c9d580f8be..31125c1372d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -696,6 +696,15 @@ subprojects {
task docsJar(dependsOn: javadocJar)
+ // Consumed by root aggregatedJavadoc; mirrors compileClasspath.
+ configurations {
+ javadocClasspathElements {
+ canBeConsumed = true
+ canBeResolved = false
+ extendsFrom configurations.compileClasspath
+ }
+ }
+
check.dependsOn('javadoc')
task systemTestLibs(dependsOn: jar)
@@ -3986,12 +3995,34 @@ project(':connect:test-plugins') {
}
}
-task aggregatedJavadoc(type: Javadoc, dependsOn: compileJava) {
+// Gradle 9+ forbids resolving a subproject's Configuration from the root.
+// Consume each subproject's javadocClasspathElements via project dependencies
instead.
+configurations {
+ aggregatedJavadocClasspath {
+ canBeConsumed = false
+ canBeResolved = true
+ }
+}
+
+task aggregatedJavadoc(type: Javadoc) {
+ destinationDir =
file("${layout.buildDirectory.get().asFile.path}/docs/javadoc")
+}
+
+gradle.projectsEvaluated {
def projectsWithJavadoc = subprojects.findAll { it.javadoc.enabled }
- source = projectsWithJavadoc.collect { it.sourceSets.main.allJava }
- classpath = files(projectsWithJavadoc.collect {
it.sourceSets.main.compileClasspath })
- includes = projectsWithJavadoc.collectMany { it.javadoc.getIncludes() }
- excludes = projectsWithJavadoc.collectMany { it.javadoc.getExcludes() }
+
+ projectsWithJavadoc.each { sp ->
+ dependencies.add('aggregatedJavadocClasspath',
+ dependencies.project(path: sp.path, configuration:
'javadocClasspathElements'))
+ }
+
+ tasks.named('aggregatedJavadoc').configure {
+ dependsOn projectsWithJavadoc.collect { "${it.path}:compileJava" }
+ source projectsWithJavadoc.collect { it.sourceSets.main.allJava }
+ classpath = configurations.aggregatedJavadocClasspath
+ includes = projectsWithJavadoc.collectMany { it.javadoc.getIncludes() }
+ excludes = projectsWithJavadoc.collectMany { it.javadoc.getExcludes() }
+ }
}