Publish on bintray using the gradle-bintray-plugin

纵饮孤独 提交于 2019-12-12 15:16:26

问题


I have an Android-Library that I would like to publish on bintray.

So far so good, I am using the gradle-bintray-plugin 1.2 with the following configuration:

bintray {
    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")

    configurations = ['archives']
    pkg {
        repo = "android" // thats how my maven repository is called on bintray
        name = "mylibrary"
        websiteUrl = "https://somewebsite" // replaced this, since the project should not matter
        issueTrackerUrl = 'some issuetracker url'
        vcsUrl = "some repository"
        licenses = ["Apache-2.0"]
        publish = true
        version {
            // the 2 functions here, are building the version number
            name = versionNameBuild() // i.e. 1.0.0-SomeName
            vcsTag = versionName()  // 1.0.0
            gpg {
                // keys are uploaded
                sign = true
            }
        }
    }
}

The first issue I ran into, was that after I uploaded the library the Version number was "unspecified". Meaning, that the file was uploaded successfully, but it was called smth. like "mylibrary-unspecified.aar". I figured out that I had to additionally specify the project version number in gradle.

like this:

project.version = "1.0.1"

After that, this was working fine. Now I have only 2 Questions left:

I would expect my files to be uploaded like this:

$BINTRAYUSERNAME/$REPONAME/$PACKAGENAME/$VERSION/*.aar

But they are actually uploaded to smth like this:

$BINTRAYUSERNAME/$REPONAME/$PROJECT_FOLDERNAME_OF_ANDROID_STUDIO/$SUBDIRECTORY_OF_THE_LIBRARY/$VERSION/*.aar

Can I change this "path" somehow? Does it matter?

Which leads me to my next question. How can I specify the maven group-type? I mean it's a maven repository right? So I should be able to set this up? Is this may be related to my first question?


回答1:


Can I change this "path" somehow? Does it matter?

Yes and yes. This path changed, as soon as I used the group variable:

group = "my.awesome.group"

This solves the second Question as well. The path of the uploaded file is then:

$BINTRAYUSERNAME/$REPONAME/$PACKAGENAME/$GROUPPATH/$VERSION/*.aar

I recommend using for Android libraries the example script.



来源:https://stackoverflow.com/questions/30381719/publish-on-bintray-using-the-gradle-bintray-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!