Search code examples
mavengradlebintray

publish a package to bintray which created by an organization


i have created a organization in bintray. when i try publishing files to the repository belong to the organization using gradle-bintray-plugin. i got a problem:

HTTP/1.1 401 Unauthorized [message:This resource requires authentication]

here is my code in build.gradle:

apply plugin: 'com.jfrog.bintray'
publishing {
    publications {
        MyPublication(MavenPublication) {
            groupId 'test.humbleadmin'
            artifactId 'm-example'
            artifact androidJar
            version version
        }
    }
}

bintray {
    user = 'my_bintray_username'
    key = 'my_bintray_key'
    publications = ['MyPublication']
    pkg {
        repo = 'repos_name'
        name = 'pkage_name'
        userOrg = 'my_org_name'
        licenses = ['MIT']
        labels = ['gear', 'gore', 'gorilla']
        publicDownloadNumbers = true
        attributes= [name: 'value'] //Optional package-level attributes
        version {
            name = '1.0'
            desc = 'TestMaven Example 1.1.0 final'
            vcsTag = '1.0'
            attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
        }
    }
}

what's wrong with my code? Thank u.


Solution

  • Make sure that the API key and the user name is correct.
    Try to access with the organization owner and his API key, if you can.

    If it doesn't help, try to operate on Bintray with Curl, you can use the REST doc: https://bintray.com/docs/api/. See that you have permissions.