From a327edff4265005f7ecea82c1f076673277137bb Mon Sep 17 00:00:00 2001 From: Glenn Renfro Date: Fri, 17 Oct 2025 14:38:25 -0400 Subject: [PATCH 1/5] Upgrade to Dokka 2.1.0 - Update `org.jetbrains.dokka` plugin from 2.0.0 to 2.1.0 - Remove Jackson 2.15.3 version resolution strategy workaround that was needed to avoid conflicts in Dokka 2.0.0 - Migrate from deprecated V1 tasks (`dokkaHtmlPartial`, `dokkaHtmlMultiModule`) to V2 API (`dokkaGeneratePublicationHtml`, `dokkaGenerate`) - Replace `dokkaSourceSets.main` configuration block with `dokkaSourceSets.configureEach` - Update `docsZip` task to depend on new `dokkaGeneratePublicationHtml` task and add explicit dependency on `:spring-integration-core:dokkaGenerate` --- build.gradle | 53 ++++++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/build.gradle b/build.gradle index 7f6ed9488a..256907a6d7 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ plugins { id 'base' id 'io.spring.nohttp' version '0.0.11' apply false id 'io.spring.dependency-management' version '1.1.7' - id 'org.jetbrains.dokka' version '2.0.0' + id 'org.jetbrains.dokka' version '2.1.0' id 'org.antora' version '1.0.0' id 'io.spring.antora.generate-antora-yml' version '0.0.1' id 'com.google.protobuf' version '0.9.5' apply false @@ -178,15 +178,6 @@ allprojects { } - // TODO Remove when Dokka 2.1.0 is released - configurations.matching { it.name.startsWith('dokka') }.configureEach { - resolutionStrategy.eachDependency { - if (requested.group.startsWith('com.fasterxml.jackson')) { - useVersion('2.15.3') - } - } - } - } configure(javaProjects) { subproject -> @@ -520,24 +511,14 @@ project('spring-integration-core') { } } - dokkaHtmlPartial { - outputDirectory.set(new File('build', 'kdoc')) - dokkaSourceSets { - main { - sourceRoots.setFrom(file('src/main/kotlin')) - classpath.from(sourceSets['main'].runtimeClasspath) - noJdkLink.set(false) - externalDocumentationLink { - url.set(new URL("https://docs.spring.io/spring-integration/docs/$version/api/")) - packageListUrl.set(file('build/docs/javadoc/element-list').toURI().toURL()) - } - externalDocumentationLink { - url.set(new URL('https://projectreactor.io/docs/core/release/api/')) - } - externalDocumentationLink { - url.set(new URL('https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/')) - } - } +dokka { + dokkaPublications.html { + outputDirectory.set(file('../build/kdoc')) + } + dokkaSourceSets.configureEach { + noJdkLink.set(false) + sourceRoots.setFrom(file('src/main/kotlin')) + classpath.from(sourceSets['main'].runtimeClasspath) } } @@ -1107,10 +1088,15 @@ tasks.register('api') { dependsOn javadoc } -dokkaHtmlMultiModule { - dependsOn 'api' +dokka { moduleName.set('spring-integration') - outputDirectory.set(file('build/kdoc')) + dokkaPublications.html { + outputDirectory.set(file('build/kdoc')) + } +} + +tasks.named('dokkaGeneratePublicationHtml') { + dependsOn 'api' } apply from: "${rootDir}/gradle/docs.gradle" @@ -1151,7 +1137,8 @@ tasks.register('schemaZip', Zip) { } tasks.register('docsZip', Zip) { - dependsOn 'dokkaHtmlMultiModule' + dependsOn 'dokkaGeneratePublicationHtml' + dependsOn ':spring-integration-core:dokkaGenerate' group = 'Distribution' archiveClassifier = 'docs' description = "Builds -${archiveClassifier} archive containing api and reference " + @@ -1165,7 +1152,7 @@ tasks.register('docsZip', Zip) { into 'api' } - from(dokkaHtmlMultiModule.outputDirectory) { + from(file('build/kdoc')) { into 'kdoc-api' } } From 86e82ee483c841cebbacdb1464df7d61c422b5a3 Mon Sep 17 00:00:00 2001 From: Glenn Renfro Date: Fri, 17 Oct 2025 16:54:41 -0400 Subject: [PATCH 2/5] Restore external documentation links for Dokka - Restore external documentation links in spring-integration-core's `dokkaSourceSets` using the new `externalDocumentationLinks. register()` API instead of deprecated `externalDocumentationLink` - Fix indentation of spring-integration-core's `dokka` configuration block to be properly scoped within the project - Remove redundant `noJdkLink.set(false)` setting (false is default) - Remove unnecessary root-level `dokka` configuration that was setting module name and output directory without effect - Remove unused `dokkaGeneratePublicationHtml` task dependency from `docsZip` as `dokkaGenerate` already handles the generation - Simplify dependency chain by relying solely on `:spring-integration-core:dokkaGenerate` - Use root project var to determine root - Move the out of core module This makes the dokka build available to all modules if necessary - Only run the module in the core module --- build.gradle | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index 256907a6d7..c596fe7d23 100644 --- a/build.gradle +++ b/build.gradle @@ -188,6 +188,8 @@ configure(javaProjects) { subproject -> apply plugin: 'kotlin' apply plugin: 'kotlin-spring' apply plugin: 'io.spring.nullability' + apply plugin: 'org.jetbrains.dokka' + apply from: "${rootDir}/gradle/publish-maven.gradle" @@ -393,6 +395,27 @@ configure(javaProjects) { subproject -> check.dependsOn checkClasspathForConflicts, javadoc + + dokka { + dokkaPublications.html { + outputDirectory.set(file(rootProject.layout.buildDirectory.file('kdoc'))) + } + dokkaSourceSets.configureEach { + sourceRoots.setFrom(file('src/main/kotlin')) + classpath.from(sourceSets['main'].runtimeClasspath) + externalDocumentationLinks.register("spring-integration-api") { + url.set(uri("https://docs.spring.io/spring-integration/docs/$version/api/")) + packageListUrl.set(file('build/docs/javadoc/element-list').toURI()) + } + externalDocumentationLinks.register("reactor-core") { + url.set(uri('https://projectreactor.io/docs/core/release/api/')) + } + externalDocumentationLinks.register("reactor-streams") { + url.set(uri('https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/')) + } + } + } + publishing { publications { mavenJava(MavenPublication) { @@ -468,7 +491,6 @@ project('spring-integration-cassandra') { project('spring-integration-core') { description = 'Spring Integration Core' - apply plugin: 'org.jetbrains.dokka' apply plugin: 'com.google.protobuf' dependencies { @@ -511,17 +533,6 @@ project('spring-integration-core') { } } -dokka { - dokkaPublications.html { - outputDirectory.set(file('../build/kdoc')) - } - dokkaSourceSets.configureEach { - noJdkLink.set(false) - sourceRoots.setFrom(file('src/main/kotlin')) - classpath.from(sourceSets['main'].runtimeClasspath) - } - } - protobuf { protoc { artifact = "com.google.protobuf:protoc:$protobufVersion" @@ -1088,17 +1099,6 @@ tasks.register('api') { dependsOn javadoc } -dokka { - moduleName.set('spring-integration') - dokkaPublications.html { - outputDirectory.set(file('build/kdoc')) - } -} - -tasks.named('dokkaGeneratePublicationHtml') { - dependsOn 'api' -} - apply from: "${rootDir}/gradle/docs.gradle" tasks.register('schemaZip', Zip) { @@ -1137,7 +1137,6 @@ tasks.register('schemaZip', Zip) { } tasks.register('docsZip', Zip) { - dependsOn 'dokkaGeneratePublicationHtml' dependsOn ':spring-integration-core:dokkaGenerate' group = 'Distribution' archiveClassifier = 'docs' From d85e6a7a7b77cc1db476e0e465e3ee6a7e1d6097 Mon Sep 17 00:00:00 2001 From: Glenn Renfro Date: Mon, 20 Oct 2025 09:43:17 -0400 Subject: [PATCH 3/5] Optimize Dokka to process selected modules only - Refactor Dokka configuration to apply only to modules with Kotlin sources, reducing build overhead and improving performance for modules without Kotlin code. - Remove deprecated commands --- build.gradle | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index c596fe7d23..92d47d9c5b 100644 --- a/build.gradle +++ b/build.gradle @@ -115,6 +115,11 @@ ext { ztZipVersion = '1.17' javaProjects = subprojects - project(':spring-integration-bom') + + // Modules that have Kotlin sources to document using dokka + dokkaProjects = [ + 'spring-integration-core' + ] } allprojects { @@ -188,8 +193,6 @@ configure(javaProjects) { subproject -> apply plugin: 'kotlin' apply plugin: 'kotlin-spring' apply plugin: 'io.spring.nullability' - apply plugin: 'org.jetbrains.dokka' - apply from: "${rootDir}/gradle/publish-maven.gradle" @@ -395,7 +398,25 @@ configure(javaProjects) { subproject -> check.dependsOn checkClasspathForConflicts, javadoc + publishing { + publications { + mavenJava(MavenPublication) { + suppressAllPomMetadataWarnings() + from components.java + pom.withXml { + def pomDeps = asNode().dependencies.first() + subproject.configurations.provided.allDependencies.each { dep -> + pomDeps.'*'.find { it.artifactId.text() == dep.name }.scope.first().value = 'provided' + } + } + } + } + } +} +// Process only the modules that require kotlin docs +configure(subprojects.findAll { dokkaProjects.contains(it.name) }) { subproject -> + apply plugin: 'org.jetbrains.dokka' dokka { dokkaPublications.html { outputDirectory.set(file(rootProject.layout.buildDirectory.file('kdoc'))) @@ -405,31 +426,16 @@ configure(javaProjects) { subproject -> classpath.from(sourceSets['main'].runtimeClasspath) externalDocumentationLinks.register("spring-integration-api") { url.set(uri("https://docs.spring.io/spring-integration/docs/$version/api/")) - packageListUrl.set(file('build/docs/javadoc/element-list').toURI()) + packageListUrl.set(file(rootProject.layout.buildDirectory.file('docs/javadoc/element-list')).toURI()) } externalDocumentationLinks.register("reactor-core") { url.set(uri('https://projectreactor.io/docs/core/release/api/')) } - externalDocumentationLinks.register("reactor-streams") { + externalDocumentationLinks.register("reactive-streams") { url.set(uri('https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/')) } } } - - publishing { - publications { - mavenJava(MavenPublication) { - suppressAllPomMetadataWarnings() - from components.java - pom.withXml { - def pomDeps = asNode().dependencies.first() - subproject.configurations.provided.allDependencies.each { dep -> - pomDeps.'*'.find { it.artifactId.text() == dep.name }.scope.first().value = 'provided' - } - } - } - } - } } project('spring-integration-test-support') { @@ -1137,7 +1143,7 @@ tasks.register('schemaZip', Zip) { } tasks.register('docsZip', Zip) { - dependsOn ':spring-integration-core:dokkaGenerate' + dependsOn dokkaProjects.collect { ":${it}:dokkaGenerate" } group = 'Distribution' archiveClassifier = 'docs' description = "Builds -${archiveClassifier} archive containing api and reference " + From 74e2a591ff91334e2d524f823a469497945fba04 Mon Sep 17 00:00:00 2001 From: Glenn Renfro Date: Tue, 21 Oct 2025 11:30:40 -0400 Subject: [PATCH 4/5] Simplify Dokka configuration with auto-discovery Replace static `dokkaProjects` list with dynamic Kotlin source detection, eliminating manual maintenance and improving automation. - Remove `dokkaProjects` list from ext block that required manual updates when adding Kotlin modules - Move Dokka plugin and configuration back into main `javaProjects` configure block for simpler structure - Update `docsZip` task to dynamically find projects with Kotlin sources using `javaProjects.findAll {it.file('src/main/kotlin'). exists()}` instead of referencing static list - Change output directory API from `buildDirectory.file('kdoc')` to `buildDirectory.dir('kdoc')` for semantically correct directory reference --- build.gradle | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 92d47d9c5b..54c9117726 100644 --- a/build.gradle +++ b/build.gradle @@ -116,10 +116,6 @@ ext { javaProjects = subprojects - project(':spring-integration-bom') - // Modules that have Kotlin sources to document using dokka - dokkaProjects = [ - 'spring-integration-core' - ] } allprojects { @@ -412,14 +408,12 @@ configure(javaProjects) { subproject -> } } } -} -// Process only the modules that require kotlin docs -configure(subprojects.findAll { dokkaProjects.contains(it.name) }) { subproject -> + // Process only the modules that require kotlin docs apply plugin: 'org.jetbrains.dokka' dokka { dokkaPublications.html { - outputDirectory.set(file(rootProject.layout.buildDirectory.file('kdoc'))) + outputDirectory.set(file(rootProject.layout.buildDirectory.dir('kdoc'))) } dokkaSourceSets.configureEach { sourceRoots.setFrom(file('src/main/kotlin')) @@ -1143,7 +1137,7 @@ tasks.register('schemaZip', Zip) { } tasks.register('docsZip', Zip) { - dependsOn dokkaProjects.collect { ":${it}:dokkaGenerate" } + dependsOn javaProjects.findAll { it.file('src/main/kotlin').exists() }.collect { ":${it.name}:dokkaGenerate" } group = 'Distribution' archiveClassifier = 'docs' description = "Builds -${archiveClassifier} archive containing api and reference " + From 48867fdfefbafbf08fa455f4bb520c56a311589b Mon Sep 17 00:00:00 2001 From: Glenn Renfro Date: Tue, 21 Oct 2025 12:49:45 -0400 Subject: [PATCH 5/5] Use dokka plugin on required modules --- build.gradle | 51 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 54c9117726..62f6d1a1d7 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ plugins { id 'base' id 'io.spring.nohttp' version '0.0.11' apply false id 'io.spring.dependency-management' version '1.1.7' - id 'org.jetbrains.dokka' version '2.1.0' + id 'org.jetbrains.dokka' version '2.1.0' apply false id 'org.antora' version '1.0.0' id 'io.spring.antora.generate-antora-yml' version '0.0.1' id 'com.google.protobuf' version '0.9.5' apply false @@ -410,23 +410,25 @@ configure(javaProjects) { subproject -> } // Process only the modules that require kotlin docs - apply plugin: 'org.jetbrains.dokka' - dokka { - dokkaPublications.html { - outputDirectory.set(file(rootProject.layout.buildDirectory.dir('kdoc'))) - } - dokkaSourceSets.configureEach { - sourceRoots.setFrom(file('src/main/kotlin')) - classpath.from(sourceSets['main'].runtimeClasspath) - externalDocumentationLinks.register("spring-integration-api") { - url.set(uri("https://docs.spring.io/spring-integration/docs/$version/api/")) - packageListUrl.set(file(rootProject.layout.buildDirectory.file('docs/javadoc/element-list')).toURI()) - } - externalDocumentationLinks.register("reactor-core") { - url.set(uri('https://projectreactor.io/docs/core/release/api/')) + if (file('src/main/kotlin')) { + apply plugin: 'org.jetbrains.dokka' + dokka { + dokkaPublications.html { + outputDirectory = rootProject.layout.buildDirectory.dir('kdoc') } - externalDocumentationLinks.register("reactive-streams") { - url.set(uri('https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/')) + dokkaSourceSets.configureEach { + sourceRoots.setFrom(file('src/main/kotlin')) + classpath.from(sourceSets['main'].runtimeClasspath) + externalDocumentationLinks.register("spring-integration-api") { + url.set(uri("https://docs.spring.io/spring-integration/docs/$version/api/")) + packageListUrl.set(file(rootProject.layout.buildDirectory.file('docs/javadoc/element-list')).toURI()) + } + externalDocumentationLinks.register("reactor-core") { + url.set(uri('https://projectreactor.io/docs/core/release/api/')) + } + externalDocumentationLinks.register("reactive-streams") { + url.set(uri('https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/')) + } } } } @@ -1136,8 +1138,21 @@ tasks.register('schemaZip', Zip) { } } +apply plugin: 'org.jetbrains.dokka' + +dependencies { + dokka project(':spring-integration-core') +} + +dokka { + moduleName = "spring-integration" + dokkaPublications.html { + outputDirectory = project.layout.buildDirectory.dir('kdoc') + } +} + tasks.register('docsZip', Zip) { - dependsOn javaProjects.findAll { it.file('src/main/kotlin').exists() }.collect { ":${it.name}:dokkaGenerate" } + dependsOn 'dokkaGenerate' group = 'Distribution' archiveClassifier = 'docs' description = "Builds -${archiveClassifier} archive containing api and reference " +