HTTP / 1.1 401 Unauthorized when uploading a binary file to bintray

I am trying to download the android library module from android studio and then this blog: https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en

(one)

./gradlew install

Result: - CREATE SUCCESSFULLY

(2)

./gradlew build bintrayUpload

Result: - Error below

FAILURE: build failed with exception.

  • What went wrong: Execution failed for task ': acr: bintrayUpload'.

    Failed to create version '1.0.0': HTTP / 1.1 401 Unauthorized [message: this resource requires authentication]

I have checked many times and am sure my username and apikey are correct. (In the username, I use the organization name instead of the bintray username because my repository is created in the organization). If anyone has an idea, I would appreciate help :)

+6
source share
1 answer

In Bintray, your username should be the username of your user account, not the organization. If you own a repo, then the permission mechanism will allow the action.

I use the name of the organization in the username

Some links to documentation:

https://github.com/bintray/gradle-bintray-plugin#readme

https://bintray.com/docs/usermanual/formats/formats_mavenrepositories.html#_working_with_gradle

EDIT: Make sure you use the userOrg parameter as your repo is under the organization object and not under the user.

check step 4 here: https://github.com/bintray/gradle-bintray-plugin#step-4-add-your-bintray-package-information-to-the-bintray-closure

Here is the working build.gradle file:

buildscript { repositories { jcenter() } dependencies { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7' } } plugins { id "com.jfrog.bintray" version "1.7" } apply plugin: 'com.jfrog.bintray' apply plugin: 'java' bintray { user = 'myuserusername' key = '**********' pkg { repo = 'gradlerepo' name = 'gradlepackage' userOrg = 'myorgname' version { name = '1.0-Final' } } } 
+10
source

All Articles