Attempting to use the 1.6.0 plugin and task dokkaH...
# dokka
s
Attempting to use the 1.6.0 plugin and task dokkaHtml in a multiplatform library project. Using a clause like this in build.gradle.kts:
Copy code
dokkaHtml {
        moduleName.set("Anything")
        dokkaSourceSets {
            named("commonMain") {
                noAndroidSdkLink.set(false)
            }
        }
        dependencies {
            dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.0")
        }
    }
and running dokkaHtml gradle task gets:
Copy code
> Task :kmp-sc:dokkaHtml FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kmp-sc:dokkaHtml'.
> org/jetbrains/dokka/model/ExtraModifiers$KotlinOnlyModifiers$Value
The github doc doesn't mention other dependencies to include explicitly, but since the only error shows a class name with no error cause, I can't tell if this is a dependency issue or not. Anyone else seen this or know what I'm doing wrong?
m
Could you provide a stacktrace? I think the flag was
--stacktrace
s
Thanks. that gives more info :-) Here's the bottom:
Copy code
Caused by: java.lang.NoClassDefFoundError: org/jetbrains/dokka/model/IntegerConstant
   at org.jetbrains.dokka.base.translators.descriptors.DokkaDescriptorVisitor.toDefaultValueExpression(DefaultDescriptorToDocumentableTranslator.kt:1033)
   at org.jetbrains.dokka.base.translators.descriptors.DokkaDescriptorVisitor.getDefaultValue(DefaultDescriptorToDocumentableTranslator.kt:1015)
   at org.jetbrains.dokka.base.translators.descriptors.DokkaDescriptorVisitor.parameter(DefaultDescriptorToDocumentableTranslator.kt:688)
   at org.jetbrains.dokka.base.translators.descriptors.DokkaDescriptorVisitor.access$parameter(DefaultDescriptorToDocumentableTranslator.kt:121)
   at org.jetbrains.dokka.base.translators.descriptors.DokkaDescriptorVisitor$visitFunctionDescriptor$2.invokeSuspend(DefaultDescriptorToDocumentableTranslator.kt:495)
   at org.jetbrains.dokka.base.translators.descriptors.DokkaDescriptorVisitor$visitFunctionDescriptor$2.invoke(DefaultDescriptorToDocumentableTranslator.kt)
   at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91)
   at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:194)
   at org.jetbrains.dokka.base.translators.descriptors.DokkaDescriptorVisitor.visitFunctionDescriptor(DefaultDescriptorToDocumentableTranslator.kt:484)
   at org.jetbrains.dokka.base.translators.descriptors.DokkaDescriptorVisitor.access$visitFunctionDescriptor(DefaultDescriptorToDocumentableTranslator.kt:121)
   at org.jetbrains.dokka.base.translators.descriptors.DokkaDescriptorVisitor$visitFunctions$2$invokeSuspend$$inlined$parallelMap$1$1.invokeSuspend(parallelCollectionOperations.kt:19)
   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
   at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.lang.ClassNotFoundException: org.jetbrains.dokka.model.IntegerConstant
   ... 17 more
Am I missing a dependency that the plugin isn't including automatically?
r
For the sake of comparison, here's the setup I have and I have no issues
Copy code
plugins {
    kotlin("multiplatform") version "1.5.31"
    id("org.jetbrains.dokka") version "1.6.0"
}
Then later in the gradle file
Copy code
tasks.dokkaHtml.configure {
// Uncomment and use the below line to configure all dokka output tasks instead of only HTML.
//tasks.withType<DokkaTask>().configureEach {

    // Set module name displayed in the final output. This should match the name in Module.md.
    moduleName.set("My Sweet Project Name")

    dokkaSourceSets {
        named("commonMain") {


            // List of files with module and package documentation
            // <https://kotlinlang.org/docs/reference/kotlin-doc.html#module-and-package-documentation>
            includes.from("docs/Module.md")

        }
    }
}
s
I'm using kotlin 1.6.0, older dokka was working before I tried to also go to 1.6.0 of dokka. I'll try the configure clause instead and see what happens. Thanks!
Nope, configure syntax does exact same thing.
Interesting, Github doc shows to include this
Copy code
dependencies {
            dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.0")
        }
but if I take that off it works.
r
I do not have that. I also only have a commonMain and commonTest src folder in my library project. I didn't mention at first because I saw you are also targeting
commonMain
.
s
Yeah, I saw you had no dependencies specified and that's why I deleted mine to try it. At least it isn't failing now, thanks!
m
Uh, please create an issue for that. It means that kotlin-as-java plugin failes for some code snippet. Also: is the project that you are running dokka on published somewhere? It would be super cool to have something to debug on
Also: this plugin was created to translate kotlin + java sources to it’s java representation in documentation. Not sure if thats what you wanted to achieve
s
Yeah the project is 99% kotlin and a little JNI (C++), I was using Gfm before. When it broke I tried switching to dokkaHtml, but now that its working I went back to Gfm and its still fine, No, the project isn't on Github but it could be, it's a library for Sqlcipher that I want to get working for iOS, so far it is only doing Android. No real reason I couldn't put it on Github after some cleanup. I'll do that tomorrow and post a link here. Once that's published, should I file a defect using the above gradle config (not what's in the current project)?
m
yeah, it would be nice to file an issue with small description of the steps you took that ended up in this exception Thanks 🙏