# Jruby-complete.jar and rails gem

**URL:** <https://www.ruby-forum.com/t/jruby-complete-jar-and-rails-gem/146324>\
**Category:** JRuby\
**Created:** [August 20, 2008, 12:37am UTC](https://www.ruby-forum.com/t/jruby-complete-jar-and-rails-gem/146324 "2008-08-20T00:37:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e0b2c6/32.png) [@Vivek\_P](https://www.ruby-forum.com/u/Vivek_P)\
**Post date:** [August 20, 2008, 12:37am UTC](https://www.ruby-forum.com/t/jruby-complete-jar-and-rails-gem/146324/1 "2008-08-20T00:37:31Z")

</div>

In GlassFish v3 I am using JRuby APIs to instantiate JRuby and Rails  
runtime. I am using maven to write a unit test for rails. My maven  
dependency is on jruby-complete.jar. However when my test tries to  
loadup  
the rails application I get the error

“Missing the Rails 2.1.0 gem. Please `gem install -v=2.1.0 rails`,  
update  
your RAILS\_GEM\_VERSION setting in config/environment.rb for the Rails  
version you do have installed, or comment out RAILS\_GEM\_VERSION to use  
the  
latest version installed.”

This explains why, because jruby-complete.jar does not have Rails gem.  
What  
options do have to make it work so that JRuby runtime can locate Rails  
gem  
as resource from the classpath?I tried copy Rails gem as part of maven  
test  
resources but this does not help.

Anyone, any idea how I can make Rails gem or anyother gem available to  
JRuby  
runtime while using jruby-complete.jar?

-vivek.

---

<div class="post-metadata">

**Author:** ![Vivek\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e0b2c6/32.png) [@Vivek\_P](https://www.ruby-forum.com/u/Vivek_P)\
**Post date:** [August 20, 2008, 1:05am UTC](https://www.ruby-forum.com/t/jruby-complete-jar-and-rails-gem/146324/2 "2008-08-20T01:05:36Z")

</div>

On Tue, Aug 19, 2008 at 5:36 PM, Vivek P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> This explains why, because jruby-complete.jar does not have Rails gem. What  
> options do have to make it work so that JRuby runtime can locate Rails gem  
> as resource from the classpath?I tried copy Rails gem as part of maven test  
> resources but this does not help.
> 
> Anyone, any idea how I can make Rails gem or anyother gem available to JRuby  
> runtime while using jruby-complete.jar?

Set the environment variable GEM\_PATH to the location of a place where  
you’ve pre-installed the Rails gem. Typically this will be something  
like

GEM\_PATH=/usr/local/jruby/lib/ruby/gems/1.8

Entries on GEM\_PATH have cache, doc, gems, and specifications  
directories.

/Nick

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Vivek\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e0b2c6/32.png) [@Vivek\_P](https://www.ruby-forum.com/u/Vivek_P)\
**Post date:** [August 20, 2008, 1:24am UTC](https://www.ruby-forum.com/t/jruby-complete-jar-and-rails-gem/146324/3 "2008-08-20T01:24:58Z")

</div>

Great! This works. Although I would have preferred a java system  
property  
but this would do.

thanks,

-vivek.

---

<div class="post-metadata">

**Author:** ![Vivek\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e0b2c6/32.png) [@Vivek\_P](https://www.ruby-forum.com/u/Vivek_P)\
**Post date:** [August 20, 2008, 1:37am UTC](https://www.ruby-forum.com/t/jruby-complete-jar-and-rails-gem/146324/4 "2008-08-20T01:37:50Z")

</div>

Well it would work in my standalone case, I can do export GEM\_PATH=…  
but  
it does not help me when I try to automate. The unit test will be run  
using  
maven and there does not appear a way to set environment variables from  
inside maven pom files:-(

-vivek.

---

<div class="post-metadata">

**Author:** ![Vivek\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e0b2c6/32.png) [@Vivek\_P](https://www.ruby-forum.com/u/Vivek_P)\
**Post date:** [August 20, 2008, 6:34am UTC](https://www.ruby-forum.com/t/jruby-complete-jar-and-rails-gem/146324/5 "2008-08-20T06:34:21Z")

</div>

On Tue, Aug 19, 2008 at 6:37 PM, Vivek P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Well it would work in my standalone case, I can do export GEM\_PATH=… but  
> it does not help me when I try to automate. The unit test will be run using  
> maven and there does not appear a way to set environment variables from  
> inside maven pom files:-(
> 
> -vivek.

Not ideal, but could you require/export GEM\_PATH in ~/.mavenrc on the  
build machine? You’d probably have to have the gems directory set up  
ahead of time anyway, unless you plan to have the gem repository  
checked in somewhere.

Otherwise you could use a java system property to pass the value along  
and have a special path to handle setting GEM\_PATH inside JRuby during  
your test setup.

/Nick

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```
