mvn-deploy Return code is: 401, ReasonPhrase: Unauthorized

7,419 views
Skip to first unread message

nup

unread,
Jul 21, 2017, 7:00:26 PM7/21/17
to Nexus Users
Hi, 

I have a strange issue, but it works one server while does not on a new server with the following setup

Using Nexus 3.4.0.02

Created user jenkins
Created maven-hosted repository third-party
Created deploy role and added jenkins user with the following rights so it can deploy to thrid-party repo


nx-repository-view-*-*-add', 'nx-repository-view-*-*-edit

nx-repository-view-*-*-read', 'nx-repository-view-*-*-browse


I have my setting.xml pointing to my third-party repo with jenkins user with password added, but cannot deploy  jar to nexus. 

mvn deploy:deploy-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=ojdbc6-11.2.0.3.jar -DgeneratePom=true -DrepositoryId=jenkins -Durl=http://server:8081/repository/third-party/


Return code is: 401, ReasonPhrase: Unauthorized


I tired with admin user, but still get the above error. 


Tried to add anonymous user to deploy role and that works. I am puzzled as to why anonymous user works when added to deploy role and jenkins user or even admin does not.  


Any help would be appreciated in solving this mystery :-)


thx


nup

unread,
Jul 22, 2017, 5:47:00 PM7/22/17
to Nexus Users
My fault as I had a typo in my -DrepositoryId=jenkins instead of third-party. 

Santosh Krishna

unread,
Jul 26, 2017, 5:36:38 AM7/26/17
to Nexus Users
Hi, 

If you fail to deploy try adding this the settings.xml
  <servers>
        <server>
            <id>nexus</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
    </servers>

probably should work. 

If you already found the solution then great :)

//Santosh

AJITH A

unread,
Jan 12, 2019, 2:30:08 AM1/12/19
to Nexus Users
hi bro
 settings.xml where is that present in project
 
Message has been deleted

Jack Duin

unread,
May 12, 2020, 2:39:48 PM5/12/20
to Nexus Users
A bit late, but not in the project. in your dependency folder:
~/.m2
Reply all
Reply to author
Forward
0 new messages