【发布时间】:2014-02-09 16:16:05
【问题描述】:
我正在尝试将我的库 ListBuddies 上传到 maven。为此,我正在使用 @ChrisBanes 的 gradle-mvn-push github 项目。我遵循他在他的 repo 中提到的所有步骤以及在使用该 repo 之前需要的其他一些步骤:
- 我打开了一个Jira 问题并一直等到它得到解决
- 我已经创建了GPG 键
- 我配置了ListBuddies's build.gradle files 和gradle.properties
- 我在“/Users/jpardogo/.gradle/gradle.properties”创建了另一个本地 gradle.properties
本地 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
看起来一切都已正确设置,但当我这样做时:
gradle clean build uploadArchives
最后我收到代码 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
我昨天和今天一整天都在寻找答案,但我无法解决。错误 401 的原因在 here 中有很好的解释,但我无法解决任何问题,我还读到这可能是由于用户权限问题,尽管我按照 guide 所说的那样在 Jira 上注册。
希望您能帮助我,如果您需要更多信息,请告诉我。谢谢。
编辑:我想用jira ticket 及其 cmets 的链接更新问题。
【问题讨论】:
-
您是否尝试通过您的凭据登录 Sonatype Nexus? JIRA 和 Nexus 的凭据通常不一样......可能在你的情况下它们是,但首先我会尝试通过浏览器登录......
-
是的,我做到了,我使用这些凭据(用户名和密码)在 Nexus UI 上登录 oss.sonatype.org/index.html#welcome
-
您是否在 build.gradle 文件中添加了
authentication(userName: mavenUser, password: mavenPassword)? -
整个项目发布在github(goo.gl/SiD5LR),是开源的。它正在与 gradle-mvn-push 一起使用,并且身份验证行在此处 goo.gl/iuk8dx 上。 gradle-mvn-push 自述文件解释了它的功能。
标签: android maven authentication android-gradle-plugin sonatype