Environment: Jruby 1.4, Eclipse 3.5
I tried to use two new great features of JRuby 1.4.0 (JSR223
integration and Gems in a jar) inside an Eclipse plugin but ran into
Here’s the list and the workarounds (or patches) I applied.
I put the jruby-complete.jar inside a plugin and want to run some
scripts from an other plugin.
- Fixing the jruby.home : JRuby can’t find the right URL alone because
Eclipse is using bundleresource URLs. So I set up the jruby.home in an
Activator like this :
final URL jrubyHomeURL = getClass().getResource("/META-INF/jruby.home");
final BundleURLConnection con = (BundleURLConnection)
String jrubyHome = con.getLocalURL().getFile().toString();
jrubyHome = jrubyHome.replaceFirst("/$", “”);
This didn’t work right away because SystemPropertyCatcher (in jruby
embed) looks for JRUBY_HOME in the environment variables first. I have
no way to override this inside my plugin so I decided to patch
SystemPropertyCatcher to not rely on the JRUBY_HOME variable. I think
that JRuby is doing the same thing internally (in RubyInstanceConfig).
- Fixing rubygems : Rubygems has now the ability to load gems from a
jar, but it doesn’t know how to handle bundle resources. I had to
patch rubygems/defaults/jruby.rb to make it aware of this (in
elsif u.getProtocol == ‘bundleresource’
bundle_url_connection = u.open_connection
Is there some cleaner way to achieve that ? (I don’t like the way I
have to patch rubygems for example).
To unsubscribe from this list, please visit: