部署工件时出错:传输文件失败返回代码为:401

jpa*_*ogo 5 authentication android sonatype maven android-gradle-plugin

我正在尝试将我的库ListBuddies上传到maven.为此,我使用@ChrisBanes的gradle-mvn-push github项目.我遵循他在回购时提到的所有步骤以及在使用回购之前需要的其他一些步骤:

本地gradle.properties文件(签名密钥只需要发布,所以不应该是SNAPSHOT的问题):

//These are the username/password that I use for:
//[JIRA](https://issues.sonatype.org) 
//and [NEXUS](https://oss.sonatype.org

NEXUS_USERNAME=jpardogo1
NEXUS_PASSWORD=jira-pass

//This is the key ID that I obtain doing "gpg --list-keys" on the terminal
signing.keyId=my-keyid

//This is the paraphrase I set when I first created the key
signing.password=my-paraphrase

//That's the path to my secret key ring
signing.secretKeyRingFile=/Users/jpardogo/.gnupg/secring.gpg
Run Code Online (Sandbox Code Playgroud)

看起来所有设置都正确,但是当我这样做时:

gradle clean build uploadArchives
Run Code Online (Sandbox Code Playgroud)

最后我收到代码ERROR 401:

:library:uploadArchives                 
Uploading: com/jpardogo/listbuddies/library/1.0.0-SNAPSHOT/library-1.0.0-20140209.151716-    1.aar to repository remote at https://oss.sonatype.org/content/repositories/snapshots/
Transferring 67K from remote            
:library:uploadArchives FAILED          

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':library:uploadArchives'.
> Could not publish configuration 'archives'
   > Error deploying artifact 'com.jpardogo.listbuddies:library:aar': Error deploying artifact: Failed to transfer file:     https://oss.sonatype.org/content/repositories/snapshots/com/jpardogo/listbuddies/library/1.0.0-SNAPSHOT/library-1.0.0-20140209.151716-1.aar. Return code is: 401

* Try:         
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED   
Run Code Online (Sandbox Code Playgroud)

我一直在寻找昨天和今天整天的答案,但我无法解决.错误401的原因很好解释在这里,但我无法解决任何问题,我也读到它可能是由于用户权限问题,尽管我在Jira注册,如指南所说.

我希望你能帮助我,如果你需要更多信息,请告诉我.谢谢.

编辑:我想用jira票证及其评论的链接更新问题.

jpa*_*ogo 4

我终于解决了。一切配置都没有问题。问题出在文件上gradle.properties。因为我复制粘贴了文件的结构,所以 NEXUS_USERNAME 旁边会提醒一个隐藏的表格,因此用户名实际上是与表格一起发送的,并且我收到了身份验证错误。

有时候事情比你想象的更简单,只是你看不到而已。下次我要做的第一件事就是检查文件的格式。