hey :wave: really struggling to get multiplatform ...
# multiplatform
r
hey 👋 really struggling to get multiplatform libraries to publish release versions to maven central. I have published many JVM kotlin libs to maven central, and my understanding is that publishing multiplatform libs should... just work the same? at least, I couldn't find anything that seemed multiplatform specific in this doc. Unfortunately, when I try to push to maven central, I get the following error
Copy code
Reason: Task ':satisfaketion-mutators:publishKotlinMultiplatformPublicationToSonatypeRepository' uses this output of task ':satisfaketion-mutators:signSatisfaketion-mutatorsPublication' 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 ':satisfaketion-mutators:signSatisfaketion-mutatorsPublication' as an input of ':satisfaketion-mutators:publishKotlinMultiplatformPublicationToSonatypeRepository'.
      2. Declare an explicit dependency on ':satisfaketion-mutators:signSatisfaketion-mutatorsPublication' from ':satisfaketion-mutators:publishKotlinMultiplatformPublicationToSonatypeRepository' using Task#dependsOn.
      3. Declare an explicit dependency on ':satisfaketion-mutators:signSatisfaketion-mutatorsPublication' from ':satisfaketion-mutators:publishKotlinMultiplatformPublicationToSonatypeRepository' using Task#mustRunAfter.
    
    For more information, please refer to <https://docs.gradle.org/8.3/userguide/validation_problems.html#implicit_dependency> in the Gradle documentation.
I don't understand why the
signSatisfaketion
output wouldn't be associated with
publishKotlinMultiplatformPublicationToSonatypeRepository
, since i thought that declaring this block
Copy code
signing {
    sign(publishing.publications)
}
Created that dependency implicitly. Am i incorrect? and regardless, does anyone have any idea how to resolve this issue 🙂 would really appreciate the help
it's a known problem :)
r
niceee ty that got me past that problem, now I'm on to the next error in the chain 😅 any chance this is a known error as well?
Copy code
> Task :satisfaketion-core:publishSatisfaketion-corePublicationToSonatypeRepository
Multiple publications with coordinates 'io.github.unredundant:satisfaketion-core:0.8.2' are published to repository 'sonatype'. The publications 'kotlinMultiplatform' in project ':satisfaketion-core' and 'satisfaketion-core' in project ':satisfaketion-core' will overwrite each other!

> Task :satisfaketion-mutators:publishSatisfaketion-mutatorsPublicationToSonatypeRepository
Multiple publications with coordinates 'io.github.unredundant:satisfaketion-mutators:0.8.2' are published to repository 'sonatype'. The publications 'kotlinMultiplatform' in project ':satisfaketion-mutators' and 'satisfaketion-mutators' in project ':satisfaketion-mutators' will overwrite each other!

> Task :satisfaketion-generators:publishSatisfaketion-generatorsPublicationToSonatypeRepository
Multiple publications with coordinates 'io.github.unredundant:satisfaketion-generators:0.8.2' are published to repository 'sonatype'. The publications 'kotlinMultiplatform' in project ':satisfaketion-generators' and 'satisfaketion-generators' in project ':satisfaketion-generators' will overwrite each other!
I can see in my local repo that things are named as i would expect
Copy code
> ls ~/.m2/repository/io/github/unredundant -al                            
drwxr-xr-x@ - megame 16 Sep 16:57 satisfaketion-core
drwxr-xr-x@ - megame 16 Sep 16:57 satisfaketion-core-js
drwxr-xr-x@ - megame 16 Sep 16:57 satisfaketion-core-jvm
drwxr-xr-x@ - megame 16 Sep 16:57 satisfaketion-generators
drwxr-xr-x@ - megame 16 Sep 16:57 satisfaketion-generators-js
drwxr-xr-x@ - megame 16 Sep 16:57 satisfaketion-generators-jvm
drwxr-xr-x@ - megame 16 Sep 16:57 satisfaketion-mutators
drwxr-xr-x@ - megame 16 Sep 16:57 satisfaketion-mutators-js
drwxr-xr-x@ - megame 16 Sep 16:57 satisfaketion-mutators-jvm
a
do you have
Copy code
publications {
                register<MavenPublication>("satisfaketion-generators") {
somewhere?
r
yeesh... the more i learn about gradle, the less I know 😨 so, i got it to work by adding the following inside the
kotlin
block for whatever reason
Copy code
val publicationsFromMainHost =
    listOf(jvm(), js()).map { it.name } + "kotlinMultiplatform"
  publishing {
    publications {
      matching { it.name in publicationsFromMainHost }.all {
        val targetPublication = this@all
        tasks.withType<AbstractPublishToMaven>()
          .matching { it.publication == targetPublication }
          .configureEach { onlyIf { findProperty("isMainHost") == "true" } }
      }
    }
  }
figured it out from this doc https://kotlinlang.org/docs/multiplatform-publish-lib.html#avoid-duplicate-publications I guess that the kotlin multiplatform plugin (unlike the kotlin jvm plugin?) has its own publication logic that can manipulate the gradle publishing flow?
tho now i'm worried because I am only seeing one source set in my local maven repo... maybe it didn't solve the problem, it just stopped publishing everything except the jvm version 😭