1

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.

Tom Anderson
  • 42,965
  • 15
  • 81
  • 123
Walter Rumsby
  • 7,005
  • 5
  • 37
  • 36

2 Answers2

2

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.

Walter Rumsby
  • 7,005
  • 5
  • 37
  • 36
  • I also decided to use a ` – Walter Rumsby Mar 14 '11 at 22:29
0

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.

Simon Lieschke
  • 12,426
  • 6
  • 43
  • 60
  • The `-r` argument is also used by standard Ruby. I'm wondering if you should just be specifying the library name e.g. `chunky_png` and `compass` and I suppose again making sure the gem archives are on the classpath. – Simon Lieschke Mar 14 '11 at 07:32