[jruby] How to integrate local GEMs, when running from a ScriptingContainer?

changepoint_advi.fischer at extaccount.com changepoint_advi.fischer at extaccount.com
Tue Jan 12 01:48:19 JST 2016

Thanks for the suggestion. I had a problem with IsolatedScriptingContainer - which you had suggested earlier, in a different thread -, in that the container was not able to locate my Scriptlet anymore, so  I did not follow this path further. I will try it again now and make a small example and report back my findings to the mailing list.


From: JRuby [mailto:jruby-bounces at ruby-lang.org] On Behalf Of christian
Sent: Monday, January 11, 2016 5:33 PM
To: JRuby project mailing list
Subject: Re: [jruby] How to integrate local GEMs, when running from a ScriptingContainer?

jruby -S gem install GEMNAME --install-dir .
jruby -r jruby/commands -e JRuby::Commands.generate_dir_info ./gems
jruby -r jruby/commands -e JRuby::Commands.generate_dir_info ./specifications

jar cvfm app.jar ..... gems specifications
then use IsolatedScriptingContainer which will set GEM_HOME and GEM_PATH to uri:classloader:/ that is where the gems are found inside the jar. no need to set it manually.
- christian

On Mon, Jan 11, 2016 at 4:22 PM, <changepoint_advi.fischer at extaccount.com<mailto:changepoint_advi.fischer at extaccount.com>> wrote:
I install my gems into a project-local directory, 'gem':

    jruby -S gem install GEMNAME --install-dir ./gem

I include this gem directory in my jar file:

  jar cvfm app.jar ..... gem

I set the environment variables GEM_HOME and GEM_PATH to 'gem'.

Finally, the ScriptingContainer invokes my scriptlet using PathType=CLASSPATH

Everything seems to work fine - for example, my scriptlet can 'require' other Ruby files included - except that a 'require' does not find my Gems.

I had expected, that GEM_HOME will be interpreted relative to CLASSPATH, but this doesn't seem to be the case.

If you are not the addressee, please inform us immediately that you have received this e-mail by mistake, and delete it. We thank you for your support.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ruby-lang.org/pipermail/jruby/attachments/20160111/61d1b53a/attachment-0001.html>

More information about the JRuby mailing list