« Return to Thread: Questions about JRuby in Maven repositories

Questions about JRuby in Maven repositories

by Alon Salant :: Rate this Message:

Reply to Author | View in Thread

I've got a Maven-managed project that uses JRuby to invoke Ruby scripts from Java using BSF.

I'm trying to sort out what is available in public Maven repositories and what version I should be using.

The JRuby FAQ at http://jruby.codehaus.org/FAQ says to use the 0.9.1-SNAPSHOT snapshot. I assume that is out of date. If so, it should be updated, perhaps to point to MvnRepository for the available versions.

MvnRepository shows a couple packagings available at http://www.mvnrepository.com/artifact/org.jruby including a 1.1b1 release. This is the version of JRuby I downloaded and installed locally so is the version I am trying to use.

First question - what's up with ruby v. jruby-complete? Which is the recommended dependency to use? The size of the jruby.jar in the 1.1b1 release (not via Maven) is 3,728kb but neither the jruby or jruby-complete jars for 1.1b1 in Maven are this size. What's the difference? Shouldn't at least one of them be the same?

Next question - which version of BSF should I be using? I see the POM for the 1.1b1 release is using 2.3.0 but there is a 2.4.0 release available. The BSF 2.3.0 dependency is listed as 'provided' in http://repo1.maven.org/maven2/org/jruby/shared/1.1b1/shared-1.1b1.pom. I assume this is because all users of JRuby will not necessarily be using it via BSF.

Next question - when using BSF 2.4.0 and JRuby 1.1b1 from Maven Central repo I get the exception:

java.lang.UnsupportedClassVersionError: Bad version number in .class file
        at java.lang.ClassLoader.defineClass1(Native Method)
        ...
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.apache.bsf.BSFManager.loadScriptingEngine(BSFManager.java:693)
        at org.apache.bsf.BSFManager.eval(BSFManager.java:435)
        ...

With 2.3.0 I do not get this error but get the following error with no additional details:

org.apache.bsf.BSFException: unable to load language: ruby
        at org.apache.bsf.BSFManager.loadScriptingEngine(Unknown Source)
        at org.apache.bsf.BSFManager.eval(Unknown Source)
        ...

Using BSF 2.3.0 or 2.4.0 and JRuby 1.0.2 from Maven Central repo JRuby appears to be working fine.

Has 1.1b1 been built for a Java 6 target JVM or something like that? Anyone else seeing this issue?

Thanks,

Alon

 « Return to Thread: Questions about JRuby in Maven repositories