Problem running rake rspec from JRuby's jar itself. JRuby's bug?

Hi everyone,

I’m trying to automate some build with maven and would like to automate
it as much as possible without requiring the potential users to install
JRuby, gems, etc. Therefore what I do is to invoke Ant with the JRuby
dependencies and run commands against the jar itself. To test that it
works, first I try to do it from the command line. But so far I’m
failing. I am executing the following:

First weird thing is that I need to set GEM_PATH. If I only set

most of the commands work, but then when I run rake rspec I get the
message: “no such file to load – set” refering to a line in the
Rakefile that has the following content “Bundler.setup(:default,
:development)”… So I’m not sure as what does that mean.
export GEM_HOME=…
export GEM_PATH=…

This runs ok. Dependencies are installed into GEM_HOME

java -jar jruby-complete.jar -S gem install … all dependencies here

Now, this fails

java -jar jruby-complete.jar -S rake spec

And this is the error:

-S bundle exec rspec “spec/test_spec.rb”
jruby: No such file or directory – bundle (LoadError)

It looks like when I run rake spec, jruby is not enforcing GEM_HOME and
so it tries to load the gems from within the JAR file, which of course

I’m not sure if there is any way to say to JRuby to load the gems from
some folder as otherwise this has to be a bug.

Also I think it is worth to mention that I’ve gone through all these
steps running them with jruby shell and then everything works fine, so
it has to be an issue related to the jar.

What do you think?


This is quite possibly a JRuby bug. There were bugs in the past
related to environment variable propagation. Could you file some more
details at, including version of JRuby, Bundler,
RSpec etc. you’re using? Anything you can do to help us replicate the
problem would be great.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs