Rake“没有要加载的文件——java”即使当 `which ruby​​` ->朱比

发布于 2025-01-04 00:17:02 字数 2490 浏览 2 评论 0原文

我是一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你是暖光i 2025-01-11 00:17:02

看起来 rvm 让我可以同时处理多个红宝石。

安装 RVM 解释了如何安装它。

rvm install jruby

确保rvm了解jruby。

rvm use jruby

更新环境,使 ruby 表示 jruby

宝石似乎是根据红宝石的口味安装的。

It looks like rvm lets me juggle multiple rubies.

Installing RVM explains how to install it.

rvm install jruby

makes sure rvm knows about jruby.

rvm use jruby

updates the environment so that ruby means jruby.

Gems seem to be installed per-flavor of ruby.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文