我正在尝试为Jruby on Rails寻找cucumber。其中一个先决条件是webrat,它具有作为先决条件的hpricot。
我已经使用hpricot安装了gem:
gem install hpricot --源http://code.whytheluckystiff.net --版本0.6.1 --平台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
发布于 2009-11-20 02:48:29
仅供参考,JRuby 1.4版现在支持0.7版HPricot。
http://jruby.org/2009/11/02/jruby-1-4-0.html
发布于 2009-04-08 20:40:14
我不知道黄瓜,但Hpricot肯定可以从JRuby 1.2.0开始使用(尽管不是Hpricot的最新版本)。您安装了哪个版本的Hpricot?也许它与其他库不兼容?
以下命令对我有效:
jruby -S gem install hpricot --version '~>0.6.1' 发布于 2009-08-24 17:13:14
自从Ola Bini上个月重写了对hpricot jruby的支持以来,hpricot的git head可以和jruby一起安装了。只需下载头部,然后使用
jruby -S rake package_jruby
cd pkg
sudo jgem install ./hpricot-0.8.1-jruby.gem你应该是金子。
https://stackoverflow.com/questions/726412
复制相似问题