4

How do we update the version of gem that JRuby uses?

JRuby uses gem (1.5.1) and we would like to upgrade it to 1.8.7. We want to have the gems installed in Ruby/gems

We run:

bin/jruby gem install rubygems-update
Fetching: rubygems-update-1.8.5.gem (100%)
Successfully installed rubygems-update-1.8.5
1 gem installed

bin/jruby gem install --system
ERROR:  While executing gem ... (OptionParser::InvalidOption)
invalid option: --system

(update does not work either)

bin/jruby gem update --system
Updating RubyGems
Updating RubyGems to 1.8.5
Installing RubyGems 1.8.5
ERROR:  While executing gem ... (Errno::EBADF)
Bad file descriptor - Bad file descriptor

How can the install/update of gem (1.8.5) be done?

Configuration:

  • using Maven to install JRuby.
  • JRuby is installed at: ~/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar
  • jruby-complete-1.6.3.jar is NOT exploded.
  • jruby-complete-1.6.3.jar has built the "gem" (1.5.1) command into it.
  • command bin/jruby that looks like this:

(bin/jruby)

export jruby_build=1.6.3
export GEM_HOME= ~/tools/ruby/gems
java -jar ~/.m2/repository/org/jruby/jruby-complete/${jruby_build}/jruby-complete-${jruby_build}.jar -S $*
  • Environment variables:

(env)

GEM_HOME=~/tools/ruby/gems
GEM_PATH=~/tools/ruby/gems
Pat
  • 5,761
  • 5
  • 34
  • 50

2 Answers2

4

If you can get update_rubygems to work, that's fine, but be aware that this may cause some JRuby-specific extensions to no longer work (e.g., maven integration). We ship RubyGems with JRuby releases so that we can ensure our extensions are compatible with the version we ship.

Nick Sieger
  • 3,315
  • 20
  • 14
  • I haven't had success yet. (I had to put it aside and just workaround the issue - whatever it maybe). – Pat Jul 27 '11 at 18:15
  • How do you get around the issue of gems not installing? The version of rubygems shipped with jruby (even 1.6.4) doesn't allow the installing of gems. It dies a horrible death. – BeepDog Sep 13 '11 at 16:13
0

Having installed rubygems-update, you then need to execute the command:

jruby -S update_rubygems

From then on, you should be able to use the normal command, i.e.

jruby -S gem update --system
Robert Brown
  • 10,888
  • 7
  • 34
  • 40
  • no. Please look at the bin/jruby code I supplied. I do provide the '-S' option. – Pat Jul 21 '11 at 00:49
  • Hmmm I'm looking and I'm not seeing it. But anyway, the `-S` is not the problem. The problem is you used the `install` command instead of the `update` command, which is what I was trying to point out. – Robert Brown Jul 21 '11 at 01:06
  • when i was creating the question, I forgot to include that I did try to do the gem update with no success either. – Pat Jul 21 '11 at 04:36
  • (modified the original question) – Pat Jul 21 '11 at 04:37
  • (modified the answer to suit) – Robert Brown Jul 21 '11 at 05:20
  • This does not work, same error results as the original question's post. – BeepDog Sep 13 '11 at 16:12
  • @BeepDog can you be more specific (there are two errors in the original post)? Better yet: raise a new question. – Robert Brown Sep 14 '11 at 00:43
  • Make sure you look at Nick Sieger's response - the answer seems to be that you're limited to the gem that ships with jruby. – James Moore Oct 30 '11 at 20:59
  • How does one install `rubygems-update`? `gem install rubygems-update-2.0.15` doesn't make `jruby -S update_rubygems` work: `jruby: No such file or directory -- update_rubygems (LoadError)` – koppor Jul 07 '15 at 18:37