https://kotlinlang.org logo
a

addamsson

11/04/2018, 6:16 PM
Is there someone who knows how to release Kotlin multiplatform projects to Maven Central using the new
kotlin-multiplatform
plugin?
t

thevery

11/04/2018, 6:48 PM
Doesn't work out of the box for Android now, see https://youtrack.jetbrains.com/issue/KT-27535
a

addamsson

11/04/2018, 6:59 PM
I'm not programming for Android
I just want to release for jvm and js platforms
I'm working on a library
h

hallvard

11/04/2018, 10:22 PM
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

josephivie

11/04/2018, 10:23 PM
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

hallvard

11/04/2018, 10:26 PM
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

addamsson

11/05/2018, 10:37 AM
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

hallvard

11/05/2018, 10:56 AM
I'm just publishing to my own Sonatype server, so I need no javadocs. Maybe that's why it works.
a

addamsson

11/05/2018, 12:01 PM
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

hallvard

11/05/2018, 12:20 PM
Sorry, no. You'll have to ask in public ...
a

addamsson

11/05/2018, 4:01 PM
where do you think I should ask?
I thought this Slack channel is the place to ask 😞
h

hallvard

11/05/2018, 4:02 PM
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

addamsson

11/05/2018, 6:09 PM
I see
thanks, anyway!
2 Views