Okay, so I rewrote the logic (sorry about before 🙏 we had a wrapper for using the old and new version while using the same old APIs for convenience until
Dokka
team fully enable the new
Dokka Gradle plugin
and exit experimental phase) using only
Dokka
apis but the bellow is using their new
Dokka Gradle plugin v2
In
gradle.properties
# Dokka
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
In
build.gradle.kts
plugins {
kotlin("jvm") version "2.1.0"
// OR
kotlin("multiplatform") version "2.1.0"
id("org.jetbrains.dokka") version "2.0.0"
}
buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0")
classpath("com.android.tools.build:gradle:8.7.3")
classpath("org.jetbrains.dokka:dokka-base:2.0.0")
}
}
apply(plugin = "org.jetbrains.dokka")
dokka {
dokkaSourceSets.configureEach {
jdkVersion.set(20)
languageVersion.set("2.1.0")
apiVersion.set("2.0")
reportUndocumented.set(true)
documentedVisibilities(
VisibilityModifier.Public,
VisibilityModifier.Private,
VisibilityModifier.Internal,
VisibilityModifier.Protected
)
sourceLink {
localDirectory.set(projectDir.resolve("src/commonMain/kotlin"))
remoteUrl("<https://github.com/$USER/$REPO_NAME/tree/main/src>")
remoteLineSuffix.set("#L")
}
}
pluginsConfiguration {
html {
customAssets.from(rootDir.resolve("Logo.png"))
footerMessage.set("(c) 2025 $COMPANY_NAME Copyright")
}
}
}
And it is working as expected and generating the documentation and including the
Private
members