Environment: Jruby 1.4, Eclipse 3.5
Hi,
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
some problems.
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)
jrubyHomeURL.openConnection();
String jrubyHome = con.getLocalURL().getFile().toString();
jrubyHome = jrubyHome.replaceFirst("/$", “”);
System.setProperty(“jruby.home”,jrubyHome);
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
spec_directories_from_classpath) :
elsif u.getProtocol == ‘bundleresource’
bundle_url_connection = u.open_connection
file_url =
URI.unescape(bundle_url_connection.getLocalURL.getFile.to_s)
Is there some cleaner way to achieve that ? (I don’t like the way I
have to patch rubygems for example).
Thanks,
Gabriel.
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email