Publish multiplatform library "Path is already exist in JCenter. POM project file is not valid."

I’m trying to publish mpp library with bintray. I did similar steps like I usualy do with android library. What I done:

  1. Created new package in bintray.
  2. Build project, and have done bintrayUpload.
    My gradle bintray script:
    apply plugin: 'com.jfrog.bintray'
    group = publishedGroupId
    version = libraryVersion

    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())

    def bintrayUser = properties.getProperty("bintray.user")
    def bintrayApiKey = properties.getProperty("bintray.apikey")
    def bintrayPassword = properties.getProperty("bintray.gpg.password")

    afterEvaluate {
    project.publishing.publications.all {
        groupId = publishedGroupId
        if (it.name.contains('metadata')) {
            artifactId = "$artifact"
        } else {
            artifactId = "$artifact-$name"
        }
    }

    bintray {
    user = bintrayUser
    key = bintrayApiKey

    pkg {
        repo = bintrayRepo
        name = bintrayName
        userOrg = developerOrg
        desc = libraryDescription
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = allLicenses
        publish = true
        publicDownloadNumbers = true
        version {
            desc = libraryDescription
            gpg {
                sign = true
                passphrase = bintrayPassword
            }
        }
    }

    bintrayUpload.doFirst {
        publications = publishing.publications.collect {
            it.name
        }.findAll {
            it != "kotlinMultiplatform"
        }
    }

    bintrayUpload.dependsOn publishToMavenLocal
  1. Tried to add this library to JCenter from bintray. And it is failed with message “Path is already exist in JCenter. POM project file is not valid.
    But the truth is that it is not added to JCenter and I cannot use it in another mpp project.

What version of ‘com.jfrog.bintray’ do you use?
If not patched by jetbrains - it does not support multiplatform.
I highly recomend migrate to maven-publish plugin.

Do you have some kind of example of using bintray with maven-publish? Bintray plugin is out of date and is quite hard to use.

Works for me - https://github.com/msink/kotlin-libui/commit/3ed479e5f26e6bc71f3e5b338752dbb5ee2160b4
It’s even a bit overcomplicated, because support of Linux/Windows/Mac requires build on multiple hosts.
And note that bintray currently have a bug woth sha512, workaround here: https://github.com/gradle/gradle/issues/11412

1 Like

Nice. I have to try it.

I even have no account in maven central.

But after errors and trials the wierd thing happend. I have added it to jcenter, but haven’t check “Is pom project” and checked “Host my spanshot build on the OSS artifactory”

https://jcenter.bintray.com/com/olekdia/multiplatform-common/

I have:

classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")

But it seems to work now

maven-publish plugin can publish to any repo, not just MavenCentral.
For bintray something like that:

publishing {
    publications.withType<MavenPublication> {
        pom {
           ...configure POM...
        }
    }

    repositories {
        maven("https://api.bintray.com/maven/${bintrayUser}/${bintrayRepo}/${project}/;publish=1") {
            credentials {
                username = bintrayUser
                password = bintrayApiKey
            }
        }
    }
}
1 Like