now getting 401 unauthorized in jenkins when deploying artifact to archiva maven repo

一世执手 提交于 2019-11-29 02:34:34

You already proved yourself that this is not a pure Jenkins issue by downgrading. Since the password lies in settings.xml, try running this from within Jenkins mvn help:effective-settings. This would give you what exactly the settings are, at run time and whether the password is in there.

Also try checking the spelling for your <id>snapshots</id> and <username>deployment</username>. I just hit this error somewhere today, where a user was releases instead of release and maven was giving forbidden errors

I would suggest installing the Config File Provider plugin, which provides a nice GUI for editing the contents of your configuration files (Such as the Maven settings file)

When configuring your build use the "-s" option to tell Maven to use one of these configuration files:

mvn -s $MY_PROJECTS_MAVEN_SETTINGS ???

The advantage of this approach is that you are sure the build is using your settings and not some random file it might be taking off the file system. The second benefit is that each project can now easily have their own specific Maven settings (For example each project will most likely have different credentials).

I figured out how to get past the problem, but I still don't know how it happened to begin with.

I created a 3rd user in Archiva, and set it so the user didn't have to change their password on 1st login. I then updated the settings.xml in Jenkins with that new user.

It now works.

I still don't know why it stopped working with the original user though.

Thanks to everyone for their help.

Thanks for following up with you solution Oggie. I just ran into the same symptom and have overcome with your new user fix.

Further info: I was able to get the old username and password to work by deleting the old user and creating a new user with exactly the same username and password. (Though I experimented with a new user with same/different passwords along the way).

With regard to the cause... I have little idea. We run Archiva on the same machine as UberSVN, and our Jenkins sits inside UberSVN as a plugin. No upgrades were made to any of these. There were however a number of ownership changes made to various directories on the server, though I can't see those being the cause given the solution was to simply create a new user.

Thanks again for the post.

I missed giving the deployment user the Role RepositoryManager after re-creating my Archiva repository. After adding the role, it solved the 401 when uploading artifacts.

See Archiva User Guide.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!