开发者

jRuby called in Ant can't find gems, what am I doing wrong

I have the following in an Ant target:

<java jar="tools/jars/jruby-complete.jar" fork="true">
    <arg value="-r"/>
    <arg value="tools/jars/chunky_png.jar"/>
    <arg value="-r"/>
    <arg value="tools/jars/compass.jar"/>
    <arg value="-S"/>
    <arg value="compass/compass-compile.rb"/>
    <arg value="${basedir}"/>
</java>

Assume the paths are correct (I've changed them slightly for this example).

My build is failing because the Gems can't be found with an error message:

`report_activate_error': Could not find RubyGem chunky_png (~> 0.12.0) (Gem::LoadError)

If I install the Gems via gem this will work, but I don't want to do that because I can't guarantee what will be on 开发者_开发技巧the build server.


Problem ended up being that I had created my chunky_png.jar incorrectly.

Having a look at Gems in a Jar I noticed that my .jar should contain a specifications directory, which my .jar didn't.

Fixing up how I created the .jar resolved the issue.


The command line parameter documentation for JRuby doesn't have spaces between the -r flag and the library. Does the following work?

<java jar="tools/jars/jruby-complete.jar" fork="true">
    <arg value="-rtools/jars/chunky_png.jar"/>
    <arg value="-rtools/jars/compass.jar"/>
    <arg value="-S"/>
    <arg value="compass/compass-compile.rb"/>
    <arg value="${basedir}"/>
</java>

Another thing to try would be putting the archives containing your gems on the classpath for your java task.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜