Rake“没有要加载的文件——java”即使当 `which ruby` ->朱比
我是一个 Ruby 菜鸟(鲁布?),在配置我的环境以让 rake
构建具有 Java 依赖项的东西时遇到问题。
我跑
$ PATH=/tmp/jruby-dodge:"$PATH" rake
并得到
/opt/local/bin/ruby -S rspec spec/contextual_spec.rb /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': 没有要加载的文件 -- java (LoadError) 来自 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require' 来自/Users/msamuel/work/igrigorik/contextual/lib/contextual/contextual.rb:1 来自 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 来自 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require' 来自/Users/msamuel/work/igrigorik/contextual/lib/contextual.rb:2 来自 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 来自 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require' 来自/Users/msamuel/work/igrigorik/contextual/spec/contextual_spec.rb:1 来自 /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load' 来自 /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files' 来自 /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map' 来自 /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files' 来自 /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22: 在 `run' 中 来自 /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process' 来自 /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run' 来自 /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10: 在 `autorun' 中 来自 /opt/local/bin/rspec:19 耙子中止! /opt/local/bin/ruby -S rspec spec/contextual_spec.rb 失败 任务:顶部 =>默认=>规格 (通过使用 --trace 运行任务查看完整跟踪)
PATH=/tmp/jruby-dodge:...
确保 which ruby
实际上解析为 /opt/local/bin/jruby< 的符号链接/代码>。
“no such file to load -- java”与jruby有关系吗? java -version
发出 java version "1.6.0_29"
所以我不认为启动 JVM 失败。
当使用rake
构建具有Java依赖项以在jruby下使用的东西时,rake
是在jruby还是ruby下运行有关系吗?如果是这样,我该如何指定?
I am a Ruby noob (rube?) and am having trouble configuring my environment to get rake
to build something with a Java dependency.
I run
$ PATH=/tmp/jruby-dodge:"$PATH" rake
and get
/opt/local/bin/ruby -S rspec spec/contextual_spec.rb /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- java (LoadError) from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /Users/msamuel/work/igrigorik/contextual/lib/contextual/contextual.rb:1 from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /Users/msamuel/work/igrigorik/contextual/lib/contextual.rb:2 from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /Users/msamuel/work/igrigorik/contextual/spec/contextual_spec.rb:1 from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `autorun' from /opt/local/bin/rspec:19 rake aborted! /opt/local/bin/ruby -S rspec spec/contextual_spec.rb failed Tasks: TOP => default => spec (See full trace by running task with --trace)
The PATH=/tmp/jruby-dodge:...
makes sure that which ruby
actually resolves to a symlink to /opt/local/bin/jruby
.
Is "no such file to load -- java" related to jruby at all? java -version
emits java version "1.6.0_29"
so I don't think there is a failure to start up a JVM.
When using rake
to build something with Java dependencies for use under jruby, does it matter whether rake
is running under jruby or ruby? If so, how do I specify that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来
rvm
让我可以同时处理多个红宝石。安装 RVM 解释了如何安装它。
确保
rvm
了解jruby。更新环境,使
ruby
表示jruby
。宝石似乎是根据红宝石的口味安装的。
It looks like
rvm
lets me juggle multiple rubies.Installing RVM explains how to install it.
makes sure
rvm
knows about jruby.updates the environment so that
ruby
meansjruby
.Gems seem to be installed per-flavor of ruby.