将Ruby on Rails 3.1.14与jRuby 1.7.6结合使用,我无法执行
RAILS_ENV=production RAILS_ENV=production /path/to/jruby -S rake --trace assets:precompile:all
设置以下选项时:
# config/environments/production.rb
config.assets.digest = false
它会产生以下堆栈跟踪:
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
No such file or directory - file:/Users/myhome/.m2/repository/org/jruby/jruby-complete/1.7.6/jruby-complete-1.7.6.jar!/META-INF/jruby.home/bin/jruby
org/jruby/RubyKernel.java:1790:in `_exec_internal'
file:/Users/myhome/.m2/repository/org/jruby/jruby-complete/1.7.6/jruby-complete-1.7.6.jar!/jruby/kernel19/kernel.rb:25:in `exec'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/actionpack-3.2.14/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/actionpack-3.2.14/lib/sprockets/assets.rake:66:in `(root)'
org/jruby/RubyProc.java:271:in `call'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/task.rb:236:in `execute'
org/jruby/RubyArray.java:1613:in `each'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/task.rb:175:in `invoke_with_call_chain'
jar:file:/Users/myhome/.m2/repository/org/jruby/jruby-complete/1.7.6/jruby-complete-1.7.6.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/application.rb:106:in `top_level'
org/jruby/RubyArray.java:1613:in `each'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/application.rb:106:in `top_level'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/application.rb:78:in `run'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/Users/myhome/Desktop/testapp/vendor/bundle/gems/rake-10.1.0/bin/rake:33:in `(root)'
org/jruby/RubyKernel.java:1101:in `load'
/Users/myhome/Desktop/testapp/vendor/bundle/bin/rake:23:in `(root)'
Tasks: TOP => assets:precompile:all
问题似乎发生在以下几行:
# actionpack-3.2.14/lib/sprockets/assets.rake:12
fork ? ruby(*args) : Kernel.exec(FileUtils::RUBY, *args)
我觉得这个exec
语句不能与jRuby一起使用。仅当digest
设置为true
时才会执行此行。
这是一个rails bug吗?我在提交错误报告之前会问这里。
答案 0 :(得分:0)
要完成此事:它肯定与jRuby不兼容,请参阅https://github.com/rails/rails/issues/12947以供参考。可悲的是,他们不会为Rails 3修复它。