Hi. Working on Kotlin Multiplatform project and fo...
# dokka
r
Hi. Working on Kotlin Multiplatform project and following this example. Running any dokka task getting error:
Copy code
Cannot change dependencies of dependency configuration ':iosArm64MainImplementationDependenciesMetadata' after task dependencies have been resolved
Anybody else experienced anything similar?
k
Could you please share your
build.gradle
file?
r
Yeah, sure no problem. settings.gradle.kts
Copy code
...
pluginManagement {
    repositories {
        gradlePluginPortal()
        jcenter()
    }
}
root build.gradle.kts
Copy code
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath(Plugins.kotlinGradlePlugin)
        classpath(Plugins.androidGradlePlugin)
        classpath(Plugins.sqlDelightPlugin)
        classpath("org.jetbrains.dokka:kotlin-as-java-plugin:1.4.10.2")
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        ...
    }
}
multiplatform module build.gradle.kts
Copy code
plugins {
    id("com.android.library")
    kotlin("multiplatform")
    id("org.jetbrains.dokka") version "1.4.10.2"
    kotlin("plugin.serialization") version Versions.kotlinVersion
    id("com.squareup.sqldelight")
}
....
tasks.withType<org.jetbrains.dokka.gradle.DokkaTask>().configureEach {
    dokkaSourceSets {
        /*
         * Giving all 'native' source sets the same name will make them displayed by a single bubble.
         */
        configureEach {
            if (platform.get() == org.jetbrains.dokka.Platform.native) {
                displayName.set("native")
            }
        }
        /*
         * Create custom source set (not known to the Kotlin Gradle Plugin)
         */
        register("customSourceSet") {
            this.jdkVersion.set(9)
            this.displayName.set("custom")
            this.sourceRoots.from(file("src/customJdk10/kotlin"))
        }
    }
}
Hope so that would be enough. Please, let me know if you need any more context info.
k
Looks fine at a first glance. You don;t have to put the
classpath("org.jetbrains.dokka:kotlin-as-java-plugin:1.4.10.2")
on the classpath I believe, as it does not have configurable parameters. It would be enough to just put it in the
dependencies
block as stated here: http://kotlin.github.io/dokka/1.4.10.2/user_guide/gradle/usage/#applying-plugins As for the bug itself could you check if it happens with Kotlin
1.4.10
?
r
1. Removed classpath declaration from root
build.gradle.kts
script 2. Ivalidated and restarted IDEA No luck. Still getting the same error. Kotlin version
1.4.10
already.
k
That’s strange. One last thing - could you please make sure that without dokka the project builds successfully? If so then please create a MRE or just share your project if it’s possible as this is the first time I’m seeing this error in the rewritten dokka’s gradle plugin and I can’t reproduce it myself
r
`android.enableJetifier=true`in gradle.properties causes this. Turning this off dokka runs successfully 🤯