Question

I am trying to upload my library, ListBuddies, to maven. To do that I am using the gradle-mvn-push github project of @ChrisBanes . I follow all the steps that he mentioned on his repo plus some others that are needed before that repo is used:

local gradle.properties file (signing keys are only need for release so should not be a problem for the 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

Look like everything is setup properly but when I do:

gradle clean build uploadArchives

At the end I receive code 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   

I have been looking for an answer the whole day of yesterday and today as well but I couldn't solve it. The error 401 reason is good explain in here, but I couldn't solved anything and I also read that It could be due user permissions problem although I register on Jira as the guide says.

I hope you can help me with that and If you need any more information, please let me know. Thanks.

EDIT: I want to update the question with the link to the jira ticket and its comments.

Was it helpful?

Solution

I finally solved it. All the configuration was ok. The problem was on the file gradle.properties. Because I copy paste the structure of the file, a hidden tabulation reminded next to the NEXUS_USERNAME, so the username actually was being sent with the tabulation and I was receiving a authentication error.

Sometimes things are more simple than you think, and you don't see them. The first thing I will do the next time will be to check the format of the files.

OTHER TIPS

I had exactly the same problem, and the reason was: my password (generated) contained a backslash \.

Solution: Backslashes need to be escaped in gradle.properties!

Example:

ossrhPassword=partBeforeBackslash\\\\partAfterBackslash

instead of:

ossrhPassword=partBeforeBackslash\partAfterBackslash

For me the problem was that I was uploading a version that already exists in the rep. The solution was just to change the 'version' in the build.gradle file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top