Running jruby under ant

I’ve been struggling here trying to run cucumber under jruby under ant.
It all works so well on the command line, but I’d like to integrate it
into a build script.

After a number of trials, I’ve come closest with the ant target shown as
‘cuke4.xml’ in ant target for running cucumber · GitHub Unfortunately, that gives
me the Gem::LoadError shown in ‘cuke4.output’

So, to investigate where jruby was looking for gems under ant, I wrote
the target in ‘gempath.xml’ and got the output shown as ‘gempath.output’
That kinda stumped me.

Can anyone explain what’s going on here? Or, more directly, can anyone
suggest how to run a ruby program using jruby under ant? I seem to be
missing an essential piece of information.

  • George


Hello George,

FYI:
org.jruby.Main is not nice class for users to kick start JRuby.
There’s embedding API for users who want to use Ruby from Java.
JRuby’s embedding API is flexible and easy to configure JRuby runtime.
Please look at org.jruby.embed package at http://jruby.org/apidocs/,
or wiki page, RedBridge · jruby/jruby Wiki · GitHub .

I’ll have a look what’s wrong with that, also, how to get started
using embedding API.

-Yoko

On Thu, Feb 9, 2012 at 3:49 PM, George Dinwiddie