a

    addamsson

    3 years ago
    Is there someone who knows how to release Kotlin multiplatform projects to Maven Central using the new
    kotlin-multiplatform
    plugin?
    t

    thevery

    3 years ago
    Doesn't work out of the box for Android now, see https://youtrack.jetbrains.com/issue/KT-27535
    a

    addamsson

    3 years ago
    I'm not programming for Android
    I just want to release for jvm and js platforms
    I'm working on a library
    hallvard

    hallvard

    3 years ago
    The matter was discussed further up in this group earlier today. I publish to a maven repo from my mpp using the
    maven-publish
    plugin, thus:
    plugins {
        id 'kotlin-multiplatform' version '1.3.0'
    //    id 'maven-publish' // cf. underneath
    }
    
    group("com.sannsyn")
    version("2.0.0-SNAPSHOT")
    
    // this line cannot appear *before* the group and version lines above ...
    apply plugin: 'maven-publish'
    ... and further down in the gradle file:
    publishing {
        publications {
            maven(MavenPublication) {
                groupId project.group
                artifactId project.name
            }
        }
    ...
    }
    josephivie

    josephivie

    3 years ago
    I'll have to do that too - I'll let you know when I figure it out. As far as I can tell, you can just apply the 'maven-publish' plugin and it will add completely working tasks like
    publishToMavenLocal
    . I don't know in particular how to configure it for Maven Central, but you might be able to do Bintray using the Bintray plugin.
    hallvard

    hallvard

    3 years ago
    Actually, the complete
    publishing
    clause that I use looks like this:
    publishing {
        publications {
            maven(MavenPublication) {
                groupId project.group
                artifactId project.name
            }
        }
        repositories {
            maven {
                credentials {
                    username "usernameHere"
                    password "somethingSecret"
                }
                def releasesRepoUrl = "<https://mvn.host.com/repository/releases/>"
                def snapshotsRepoUrl = "<https://mvn.host.com/repository/snapshots/>"
                url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
            }
        }
    }
    So maybe it's just a matter of defining the correct maven central?
    a

    addamsson

    3 years ago
    this is not enough
    for maven central you need javadoc and sources as well
    and you can't use javadoc in a common project
    you also need a lot of other stuff like signing, scm url, etc
    This is the docs on it
    but it doesn't work
    I have a multiplatform project which uses the old model
    and I had to hack around it to be able to publish to maven cetnral
    but with the new plugin it is not working at all
    I'll take another stab at it later with the
    maven-publish
    plugin
    hallvard

    hallvard

    3 years ago
    I'm just publishing to my own Sonatype server, so I need no javadocs. Maybe that's why it works.
    a

    addamsson

    3 years ago
    yep
    but maven central won't accept artifacts without sources and javadoc
    do you know someone who publishes kotlin multiplatform projects to maven central?
    hallvard

    hallvard

    3 years ago
    Sorry, no. You'll have to ask in public ...
    a

    addamsson

    3 years ago
    where do you think I should ask?
    I thought this Slack channel is the place to ask 😞
    hallvard

    hallvard

    3 years ago
    Yes, thats what I meant.
    a

    addamsson

    3 years ago
    I already asked this on #multiplatform
    hallvard

    hallvard

    3 years ago
    I know that. But did you specify the javadoc demands (apart from within this thread)? Gradle can be told to generate javadoc as well. But I'm not the right person to ask about this. In your place, I'd ask in #multiplatform again, with as much detail as possible.
    a

    addamsson

    3 years ago
    I see
    thanks, anyway!