我正在尝试查看 Jruby on Rails 的黄瓜。其中一个先决条件是 webrat,它具有先决条件 hpricot。
我已经使用 hpricot 安装了 gem:
gem install hpricot --source http://code.whytheluckystiff.net --version 0.6.1 --platform java
这将安装 hpricot 的 java 版本。我将 hpricot_scan.jar 添加到 CLASSPATH 但是当我运行时:
cucumber features -n
我得到以下输出:
HpricotScanService.java:931:in `hpricot_scan': java.lang.NoSuchMethodError:
org.jruby.runtime.builtin.IRubyObject.getInstanceVariable(Ljava/lang/String;)Lorg/jruby/runtime/builtin/IRubyObject;
from HpricotScanService.java:1324:in `__hpricot_scan'
from null:-1:in `call'
from InvocationCallback.java:67:in `execute'
from FullFunctionCallbackMethod.java:69:in `call'
from DynamicMethod.java:243:in `call'
from CachingCallSite.java:283:in `cacheAndCall'
from CachingCallSite.java:121:in `callBlock'
等等
如果我编译 HpricotScanService.java 文件并将生成的 .class 文件添加到类路径中,我会得到:
Then I should see "Run"
private method `scan' called for Hpricot:Module (NoMethodError)
features/step_definitions/webrat_steps.rb:94:in `/^I should see "([^\"]*)"$/'
features/manage_activity.feature:9:in `Then I should see "Run"'
如果我尝试安装更高版本的 hpricot,那么我会得到:
ERROR: Failed to build gem native extension.
C:/Program Files/Ruby/jruby-1.2.0/bin/../bin/jruby.bat extconf.rb install hpricot --platform java
C:/Program Files/Ruby/jruby-1.2.0/bin/../lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (Not
ImplementedError)
from C:/Program Files/Ruby/jruby-1.2.0/bin/../lib/ruby/1.8/mkmf.rb:1:in `require'
from extconf.rb:1
有没有人知道我做错了什么/没有做什么/我在哪里愚蠢。?
使用 Windows XP、JRuby 1.2.0