Is there someone who knows how to release Kotlin m...
# multiplatform
a
Is there someone who knows how to release Kotlin multiplatform projects to Maven Central using the new
kotlin-multiplatform
plugin?
t
Doesn't work out of the box for Android now, see https://youtrack.jetbrains.com/issue/KT-27535
a
I'm not programming for Android
I just want to release for jvm and js platforms
I'm working on a library
h
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:
Copy code
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:
Copy code
publishing {
    publications {
        maven(MavenPublication) {
            groupId project.group
            artifactId project.name
        }
    }
...
}
👍 1
j
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.
h
Actually, the complete
publishing
clause that I use looks like this:
Copy code
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
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
h
I'm just publishing to my own Sonatype server, so I need no javadocs. Maybe that's why it works.
a
yep
but maven central won't accept artifacts without sources and javadoc
do you know someone who publishes kotlin multiplatform projects to maven central?
h
Sorry, no. You'll have to ask in public ...
a
where do you think I should ask?
I thought this Slack channel is the place to ask 😞
h
Yes, thats what I meant.
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
I see
thanks, anyway!