Search code examples
ruby-on-rails-3jrubyjrubyonrails

How do I ensure my jruby command line options are used when running "rails", "rake", "rspec" etc?


I currently run my Rails app using:

jruby --1.9 -J-XX:+CMSClassUnloadingEnabled -J-XX:+UseConcMarkSweepGC -J-XX:MaxPermSize=256m -S rails server

This is getting pretty old now. How can I set my Rails project up so that just running

rails server

has the same effect?

(Note: bash aliases and the like are not what I'm looking for here. I want to make the project work right, not fix my local settings)


Solution

  • When using RVM and a project .rvmrc, the canonical way is to set PROJECT_JRUBY_OPTS in the project .rvmrc. A bug prevented this from working for me, so use rvm head.

    If not using rvm then use JRUBY_OPTS, which is the built-in way of doing it that JRuby checks (in fact, the PROJECT_JRUBY_OPTS thing ends up being converted to JRUBY_OPTS by rvm).