I found this informative article in Kristian’s Blog that shows how to
create
a Maven project from a ruby gem and then install the Maven artifact (gem
package type) in the local Maven repository:
http://blog.mkristian.tk/2010_08_01_archive.html
I then wanted to use the ruby gem as a Maven dependency to run a ruby
script
in a Maven project using the jruby-maven-plugin. The jruby-maven-plugin
section of the pom.xml looks like the following:
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>jruby-maven-plugin</artifactId>
<version>0.23.0</version>
<dependencies>
<dependency>
<groupId>rubygems</groupId>
<artifactId>rubyzip2</artifactId>
<version>2.0.1</version>
<type>gem</type>
</dependency>
</dependencies>
<executions>
<execution>
<id>test-hello</id>
<phase>verify</phase>
<goals>
<goal>jruby</goal>
</goals>
<inherited>false</inherited>
</execution>
</executions>
<configuration>
<file>hello.rb</file>
</configuration>
</plugin>
The gem artifact is installed in the local Maven repository.
There is a require statement in hello.rb for the gem:
require ‘rubygems’
require ‘zip/zip’
puts "hello from ruby "*20
When I run the Maven build, I get an error:
[INFO] — jruby-maven-plugin:0.23.0:jruby (test-hello) @
bundled-gem-experiment —
[WARNING]
file:/Users/me/.m2/repository/org/jruby/jruby-complete/1.5.6/jruby-complete-1.5.6.jar!/META-INF/jruby.home/li
b/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require': no such file to load -- zip/zip (LoadError) [WARNING] from file:/Users/me/.m2/repository/org/jruby/jruby-complete/1.5.6/jruby-complete-1.5.6.jar!/META-INF/jruby.h ome/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require’
[WARNING] from
/Users/me/Desktop/Helios/helios_workspace/bundled-gem-experiment/hello.rb:2
[WARNING] from
/Users/me/Desktop/Helios/helios_workspace/bundled-gem-experiment/hello.rb:1:in
`load’
[WARNING] from -e:1
Does the jruby-maven-plugin currently support running a ruby script with
a
require that references a Maven gem artifact? Am I doing this
incorrectly?
Thanks for any help in getting this to work!
–
View this message in context:
http://old.nabble.com/Executing-ruby-script-with-a-'require'-via-jruby-maven-plugin-tp30764600p30764600.html
Sent from the JRuby - User mailing list archive at Nabble.com.