Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error deploying artifact: Failed to transfer file Return code is: 401

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:

  • I opened a Jira issue and I waited until It got resolved
  • I have created GPG keys
  • I configurate ListBuddies's build.gradle files and the gradle.properties
  • I have created another local gradle.properties at "/Users/jpardogo/.gradle/gradle.properties"

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.

like image 872
jpardogo Avatar asked Oct 01 '22 15:10

jpardogo


1 Answers

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.

like image 57
jpardogo Avatar answered Oct 05 '22 12:10

jpardogo