Skolson5903
06/14/2025, 1:46 AMdokkaPublications.html {
outputDirectory.set(rootDir.resolve("docs/api/0.x"))
includes.from(project.layout.projectDirectory.file("README.md"))
}
but when I try this the html clause is an unresolved reference (using Idea 2025.2 EAP). And using the snippet below the builds/dokka folder has only an empty javadoc subfolder, so nothing is being generated. Since this is KMP I know V 2.0.0 doesn't support the javadoc option. What do I need to add to get the HTML to generate? Here's my beginning dokka snippet:
dokka {
moduleName.set("Kotlin Multiplatform Common IO Library")
dokkaSourceSets.commonMain {
includes.from("$appleFrameworkName.md")
}
}
Also, as a followup, I've struggled to find an example of how to tell maven publish to publish the HTML once generated. I'd also appreciate any info on that.
Thanks in advance for any help...Skolson5903
06/14/2025, 2:50 AMSkolson5903
06/14/2025, 3:28 AMval htmlJarTask = tasks.register<Jar>("htmlJar") {
archiveClassifier.set("htmldoc")
dependsOn(tasks.dokkaGeneratePublicationHtml)
}
and added artifact(htmlJarTask)
to the publish. That caused a signing-related error on the html jar, so I'm still doing this wrong 🙂. The error for the android publish task looks like this:
- Gradle detected a problem with the following location: '/mnt/Projects/KmpIO/KmpIO/build/libs/KmpIO-0.1.8-htmldoc.jar.asc'.
Reason: Task ':KmpIO:publishAndroidDebugPublicationToMavenLocal' uses this output of task ':KmpIO:signAndroidReleasePublication' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':KmpIO:signAndroidReleasePublication' as an input of ':KmpIO:publishAndroidDebugPublicationToMavenLocal'.
2. Declare an explicit dependency on ':KmpIO:signAndroidReleasePublication' from ':KmpIO:publishAndroidDebugPublicationToMavenLocal' using Task#dependsOn.
3. Declare an explicit dependency on ':KmpIO:signAndroidReleasePublication' from ':KmpIO:publishAndroidDebugPublicationToMavenLocal' using Task#mustRunAfter.
Seems wrong to have to explicitly specify the dependencies above to get this to work, and then do that on all the different target platform tasks as well. Worse, the HTML jars now being generated only have a manifest file, so the generate is running with no errors but producing basically nothing. Still looking...Skolson5903
06/14/2025, 3:20 PMfrom(project.layout.buildDirectory.dir("dokka/html"))
To help with the android dependency issue, tried adding the html jar artifact to the androidTarget block:
androidTarget {
publishLibraryVariants("release", "debug")
mavenPublication {
artifactId = artifactId.replace(project.name, mavenArtifactId)
artifact(htmlJarTask)
}
}
where mavenArtifactId is the project name. That results in a different error:
Execution failed for task ':KmpIO:publishAndroidDebugPublicationToMavenLocal'.
> Failed to publish publication 'androidDebug' to repository 'mavenLocal'
> Invalid publication 'androidDebug': multiple artifacts with the identical extension and classifier ('jar.asc', 'htmldoc').
So still looking. I don't know why gradle thinks at least in the android case why there are multiple htmlJar artifacts.
It sure would be nice if there was some explicit doc on publishing to maven and mavenlocal when using Dokka v2 and the HTML output. If there is I've been unable to find it with searches....Skolson5903
06/14/2025, 4:07 PMif (name == "androidRelease")
artifact(htmlJarTask)
so that would only include the jar artifact on release builds. To avoid duplication I also added this to the publishing block:
if (name != "androidDebug" && name != "androidRelease") {
artifact(htmlJarTask)
}
So now the jar is only included in androidRelease and non-android builds. That fixed the duplicate extension and classifier issue but surprisingly resulted in this:
A problem was found with the configuration of task ':KmpIO:signJvmPublication' (type 'Sign').
- Gradle detected a problem with the following location: '/mnt/Projects/KmpIO/KmpIO/build/libs/KmpIO-0.1.8-htmldoc.jar.asc'.
Reason: Task ':KmpIO:publishAndroidReleasePublicationToMavenLocal' uses this output of task ':KmpIO:signJvmPublication' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
So now there's a dependency crossover between the signJvmPublication task and the androidRelease task?? This feels like a bug. If anyone has gotten this to work I'd love to hear about it. I have to go back to Dokka V1 where publishes of javadoc with signing work until this gets figured out.Oleg Yukhnevich
06/16/2025, 12:53 PMSkolson5903
06/17/2025, 12:34 AMSkolson5903
06/21/2025, 10:47 PMSkolson5903
06/21/2025, 11:23 PM> Task :KmpIO:signKotlinMultiplatformPublication FAILED
> Task :KmpIO:signLinuxArm64Publication FAILED
> Task :KmpIO:signLinuxX64Publication FAILED
[Incubating] Problems report is available at: file:///mnt/Projects/KmpIO/build/reports/problems/problems-report.html
FAILURE: Build completed with 3 failures.
1: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':KmpIO:signKotlinMultiplatformPublication' (type 'Sign').
- Gradle detected a problem with the following location: '/mnt/Projects/KmpIO/KmpIO/build/libs/KmpIO-0.1.8-htmldoc.jar.asc'.
Reason: Task ':KmpIO:publishJvmPublicationToMavenLocal' uses this output of task ':KmpIO:signKotlinMultiplatformPublication' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':KmpIO:signKotlinMultiplatformPublication' as an input of ':KmpIO:publishJvmPublicationToMavenLocal'.
2. Declare an explicit dependency on ':KmpIO:signKotlinMultiplatformPublication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#dependsOn.
3. Declare an explicit dependency on ':KmpIO:signKotlinMultiplatformPublication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#mustRunAfter.
For more information, please refer to <https://docs.gradle.org/8.14.2/userguide/validation_problems.html#implicit_dependency> in the Gradle documentation.
* Try:
> Declare task ':KmpIO:signKotlinMultiplatformPublication' as an input of ':KmpIO:publishJvmPublicationToMavenLocal'
> Declare an explicit dependency on ':KmpIO:signKotlinMultiplatformPublication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#dependsOn
> Declare an explicit dependency on ':KmpIO:signKotlinMultiplatformPublication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#mustRunAfter
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':KmpIO:signLinuxArm64Publication' (type 'Sign').
- Gradle detected a problem with the following location: '/mnt/Projects/KmpIO/KmpIO/build/libs/KmpIO-0.1.8-htmldoc.jar.asc'.
Reason: Task ':KmpIO:publishJvmPublicationToMavenLocal' uses this output of task ':KmpIO:signLinuxArm64Publication' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':KmpIO:signLinuxArm64Publication' as an input of ':KmpIO:publishJvmPublicationToMavenLocal'.
2. Declare an explicit dependency on ':KmpIO:signLinuxArm64Publication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#dependsOn.
3. Declare an explicit dependency on ':KmpIO:signLinuxArm64Publication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#mustRunAfter.
For more information, please refer to <https://docs.gradle.org/8.14.2/userguide/validation_problems.html#implicit_dependency> in the Gradle documentation.
* Try:
> Declare task ':KmpIO:signLinuxArm64Publication' as an input of ':KmpIO:publishJvmPublicationToMavenLocal'
> Declare an explicit dependency on ':KmpIO:signLinuxArm64Publication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#dependsOn
> Declare an explicit dependency on ':KmpIO:signLinuxArm64Publication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#mustRunAfter
> Run with --scan to get full insights.
==============================================================================
3: Task failed with an exception.
-----------
* What went wrong:
A problem was found with the configuration of task ':KmpIO:signLinuxX64Publication' (type 'Sign').
- Gradle detected a problem with the following location: '/mnt/Projects/KmpIO/KmpIO/build/libs/KmpIO-0.1.8-htmldoc.jar.asc'.
Reason: Task ':KmpIO:publishJvmPublicationToMavenLocal' uses this output of task ':KmpIO:signLinuxX64Publication' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':KmpIO:signLinuxX64Publication' as an input of ':KmpIO:publishJvmPublicationToMavenLocal'.
2. Declare an explicit dependency on ':KmpIO:signLinuxX64Publication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#dependsOn.
3. Declare an explicit dependency on ':KmpIO:signLinuxX64Publication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#mustRunAfter.
For more information, please refer to <https://docs.gradle.org/8.14.2/userguide/validation_problems.html#implicit_dependency> in the Gradle documentation.
* Try:
> Declare task ':KmpIO:signLinuxX64Publication' as an input of ':KmpIO:publishJvmPublicationToMavenLocal'
> Declare an explicit dependency on ':KmpIO:signLinuxX64Publication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#dependsOn
> Declare an explicit dependency on ':KmpIO:signLinuxX64Publication' from ':KmpIO:publishJvmPublicationToMavenLocal' using Task#mustRunAfter
> Run with --scan to get full insights.
==============================================================================
BUILD FAILED in 1m 41s
I'm still unsure how to proceed with this. I thought the maven publish plugin should properly handle the HTML jar as an artifact and publish it to all the targets, as well as a KMP one for the common 'target'. Looking in build/libs (the default output location for the Jar task) I only see KmpIO-0.1.8-htmldoc.jar
and KmpIO-0.1.8-androidhtmldoc.jar
. None of the other target HTML jars are created, but maybe that's because the error happens first. Interestingly there are signing files for each of these jars, so signing did that much. Anyway, any thoughts on how to diagnose what's happening here are welcome!Skolson5903
06/21/2025, 11:51 PMafterEvaluate {
tasks.getByName("publishJvmPublicationToMavenLocal") {
this.inputs.files.forEach {
println("publishJvm input: ${it.path} ${it.name}")
}
}
tasks.getByName("signKotlinMultiplatformPublication") {
this.outputs.files.forEach {
println("signKMP output: ${it.path} ${it.name}")
}
}
}
Results of sync:
htmlJarTask.configure output: /mnt/Projects/KmpIO/KmpIO/build/libs
publishJvm input: /mnt/Projects/KmpIO/KmpIO/build/libs/KmpIO-0.1.8-htmldoc.jar KmpIO-0.1.8-htmldoc.jar
publishJvm input: /mnt/Projects/KmpIO/KmpIO/build/publications/jvm/pom-default.xml pom-default.xml
==> publishJvm input: /mnt/Projects/KmpIO/KmpIO/build/libs/KmpIO-0.1.8-htmldoc.jar.asc KmpIO-0.1.8-htmldoc.jar.asc
publishJvm input: /mnt/Projects/KmpIO/KmpIO/build/publications/jvm/pom-default.xml.asc pom-default.xml.asc
signKMP output: /mnt/Projects/KmpIO/KmpIO/build/kotlinToolingMetadata/kotlin-tooling-metadata.json.asc kotlin-tooling-metadata.json.asc
signKMP output: /mnt/Projects/KmpIO/KmpIO/build/libs/KmpIO-0.1.8-htmldoc.jar.asc KmpIO-0.1.8-htmldoc.jar.asc
signKMP output: /mnt/Projects/KmpIO/KmpIO/build/publications/kotlinMultiplatform/module.json.asc module.json.asc
signKMP output: /mnt/Projects/KmpIO/KmpIO/build/publications/kotlinMultiplatform/pom-default.xml.asc pom-default.xml.asc
The signing outputs look correct for the KMP task. But the publish JVM task has the signing file from the KMP task as input. I highlighted that line. Why would publish do that? Lol I think I'm stuck.Oleg Yukhnevich
06/23/2025, 10:52 AMsigning
plugin, which messes this up, you receive such errors.
I do have a workaround for a similar situation in one of my personal projects
That's needed because we have one jar file which is signed multiple times, as the same file is included in multiple publications
Also, I wanted to point out that publication to Maven Central via the default Gradle maven-publish
plugin will stop working on June 30 because of the sunset of OSSRH by Sonatype.
In light of this, you might want to migrate to https://github.com/vanniktech/gradle-maven-publish-plugin, which, in addition to support for the new Maven Central publication workflow, better handles the case with attaching Dokka or javadoc jars there.Skolson5903
06/23/2025, 3:49 PMSkolson5903
06/23/2025, 9:52 PM