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

christian m.kristian at web.de
Tue Jan 12 01:32:41 JST 2016


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>
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/9ebce921/attachment.html>


More information about the JRuby mailing list