在Bintray上上传二进制文件时未经授权的HTTP/1.1 401 [英] HTTP/1.1 401 Unauthorized when uploading binary on bintray

查看:195
本文介绍了在Bintray上上传二进制文件时未经授权的HTTP/1.1 401的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从android studio上传一个android库模块, 随后是此博客: https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en

(1)

./gradlew安装

结果:-建立成功

(2)

./gradlew构建bintrayUpload

结果:-出现以下错误-

失败:构建失败,并出现异常.

  • 出了什么问题: 任务':acr:bintrayUpload'的执行失败.

    无法创建版本'1.0.0':HTTP/1.1 401未经授权[消息:此资源需要身份验证]

我检查了很多次,确保我的用户名和apikey是正确的. (在用户名中,我使用组织名称而不是Bintray用户名,因为我的存储库是在组织下创建的). 如果有人有想法,我将不胜感激:)

解决方案

在Bintray中,您的用户名必须是用户帐户的用户名,而不是组织的用户名. 如果您是存储库的所有者,则权限机制将允许该操作.

在用户名中,我使用的是组织名称

一些文档链接:

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

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

确保您使用的是userOrg参数,因为您的回购在组织主题下,而不在用户下.

在此处检查第4步: https://github. com/bintray/gradle-bintray-plugin#step-4-add-your-bintray-package-information-the-bintray-closure

这是可以正常工作的build.gradle:

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'
        }
    }
}

I'm trying to upload a android library module from android studio, followed by this blog: https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en

(1)

./gradlew install

Result:- BUILD SUCCESSFUL

(2)

./gradlew build bintrayUpload

Result:- Getting below error-

FAILURE: Build failed with an exception.

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

    Could not create version '1.0.0': HTTP/1.1 401 Unauthorized [message:This resource requires authentication]

I checked many times and sure my username and apikey is correct. (In username i'm using organization name instead of bintray username because my repository is created under organization). If anyone has an idea, I would appreciate the help :)

解决方案

In Bintray your username must be the username of your user account and not the Organisation. If you are the owner of the repo then the permission mechanism will allow the action.

In username i'm using organization name

Some documentation links:

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

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

EDIT: Make sure you are using the userOrg parameter, since your repo is under the organization subject 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 a working build.gradle:

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'
        }
    }
}

这篇关于在Bintray上上传二进制文件时未经授权的HTTP/1.1 401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆