Fix dokkaGenerate for Kotlin Multiplatform modules - #714
Conversation
Two issues break `dokkaGenerate` under Dokka 2.2.0:
- `forceVersions()` applied the project's version forcing (and
`failOnVersionConflict()`) to Dokka's own generator/plugin configurations,
conflicting with the versions Dokka pins (e.g. Jackson 2.15.3 vs the forced
2.22.0). Skip configurations whose name starts with `dokka`.
- The `org.jetbrains.dokka-javadoc` format cannot resolve Kotlin Multiplatform
source sets ("No source set found for <module>/jvmMain"), failing the Javadoc
publication for every KMP module. KMP modules publish HTML docs, so disable the
Javadoc publication task for them.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dokkaGenerate for Kotlin Multiplatform modules
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: abd441818e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Adopt the `buildSrc` fix from SpineEventEngine/config#714 so `dokkaGenerate` (the "Check documentation" CI step) succeeds for this repo's KMP modules: - `forceVersions()` skips Dokka's own generator/plugin configurations, which pin their own dependency versions (e.g. Jackson 2.15.3) and must not get the project's version forcing. - the Dokka Javadoc publication is disabled for KMP modules (they publish HTML docs); its task cannot resolve KMP source sets. This carries the fix ahead of the official `config` release. Once config#714 merges, re-pin the `config` submodule to master and re-sync `buildSrc` normally. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes ./gradlew dokkaGenerate failures under Dokka 2.2.0 in builds containing Kotlin Multiplatform (KMP) modules by preventing project-wide dependency version forcing from affecting Dokka’s isolated runtime classpath and by disabling the Dokka Javadoc publication task for KMP modules (which Dokka Javadoc format cannot handle).
Changes:
- Excludes Dokka-owned
dokka*configurations fromforceVersions()to avoid dependency conflicts on Dokka generator/plugin classpaths. - Disables
dokkaGeneratePublicationJavadocwhen the Kotlin Multiplatform plugin is applied, avoiding the KMP source set resolution failure. - Updates copyright headers to 2026.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| buildSrc/src/main/kotlin/dokka-setup.gradle.kts | Disables Dokka’s Javadoc publication task for KMP modules to avoid source set lookup failures. |
| buildSrc/src/main/kotlin/DependencyResolution.kt | Skips version forcing / conflict-fail strategy for dokka* configurations so Dokka can resolve its pinned tool dependencies. |
`kmp-module.gradle.kts` and `jvm-module.gradle.kts` each register their own
`configurations.all { … }` block that forces the project's Jackson (and other)
versions onto every configuration. Like `forceVersions()`, these must skip
Dokka's own `dokka…` configurations so Dokka keeps its pinned dependency
versions and `dokkaGenerate` does not break for KMP modules.
Addresses the review note on the incomplete exemption.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6cba9d4814
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
armiol
left a comment
There was a problem hiding this comment.
@alexander-yevsyukov I think Codex may have a point. Just in case, requesting the changes.
`BomsPlugin` still forced the project's Kotlin, StdLib, Coroutines, and JUnit versions onto Dokka's own `dokka*` configurations, substituting them on Dokka's isolated tool classpath — the remaining gap raised by Codex in the review of this PR. Extract the `dokka*` predicate into a single shared `Configuration.isDokka` helper in `io.spine.dependency`, and route every version-forcing site through it (`DependencyResolution`, `jvm-module`, `kmp-module`, and now `BomsPlugin`), so the exemption can no longer be applied inconsistently. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@armiol — pushed fd4a346 addressing Codex's remaining open point (P2).
Both Codex threads are resolved. Ready for another look. |
Problem
Under Dokka 2.2.0,
./gradlew dokkaGeneratefails for any repository that hasKotlin Multiplatform modules (reproduced in
SpineEventEngine/logging). Two distinctissues combine:
Version forcing leaks into Dokka's tool classpath.
forceVersions()applies theproject's version forcing and
failOnVersionConflict()to every configuration,including Dokka's isolated
dokka*GeneratorRuntimeResolverclasspath. Dokka 2.2.0pins its own dependencies (e.g.
jackson-*:2.15.3,kotlin-stdlib:2.0.21), whichconflict with the project's forced versions (e.g.
Jackson.bom2.22.0):Could not resolve … Conflict found for module 'com.fasterxml.jackson…': between versions 2.22.0 and 2.15.3.The Dokka Javadoc format can't handle KMP source sets. The
org.jetbrains.dokka-javadocplugin'sdokkaGeneratePublicationJavadoctask failsfor every KMP module with
No source set found for <module>/jvmMain.Fix
DependencyResolution.forceVersions()— skip configurations whose name starts withdokka, leaving Dokka's own classpath to resolve as Dokka intends.dokka-setup.gradle.kts— disabledokkaGeneratePublicationJavadocfor KMP modules(they publish HTML docs via
htmlDocsJar).Verification
Applied to
SpineEventEngine/logging(which has many KMP modules):./gradlew dokkaGeneratenow completes successfully (it previously failed on:logging,:context-tests, and every other KMP module).🤖 Generated with Claude Code