405 returned when pushing Gem to Nexus Repo


I’m having issues pushing my gem to my nexus repo using the nexus gem.

I build and install the gem fine, but as soon as I try to push, it seems as though its working but doesn’t using the following command:

gem nexus --url http://nexus.host/repository/rubygems-group <gemname>

I receive the following output:

Uploading 1 gem to Nexus…
PUT mygem-0.1.gem

and my gem is nowhere to be seen in the repo - running the command with options such as verbose, debug etc returns the folowing:

gem nexus -c -V --debug --backtrace --url http://nexus.host/repository/rubygems-group ./mygem-0.1.gem 
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `LoadError' at C:/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59 - cannot load such file -- rubygems/commands/nexus_command
Exception `LoadError' at C:/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:137 - cannot load such file -- rubygems/commands/nexus_command
The Nexus URL has been stored in H:/.gem/nexus
Enter your Nexus credentials
Username:   test_user
Password:   *********
Your Nexus credentials have been stored in H:/.gem/nexus
Uploading 1 gem to Nexus...
PUT http://nexus.host/repository/rubygems-group/gems/mygem-0.1.gem
use authorization
response code: 405**
PUT mygem-0.1.gem

This was previously working as I have other versions of the Gem in the repo, but I don’t know what has changed as the push was a while ago.

** the Nexus Gem Source was edited to print out the return code.

Nexus version 3.8.0-02
Ruby version 2.4.4p296

Any help appreciated.
Thanks in advance.

Is the repository you are trying to push your gem a group repository? Usually group repositories are used when you do a build and need to pull from multiple sources. When you need to push an artifact into the repo, it is done to a single hosted repo.

1 Like


I did try the hosted repo prior, but I didn’t use the -c option to reset the URL and creds - looking back at my output, when I specified the hosted repo url I see it used the old group repo url instead.