<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-%27require%27-via-jruby-maven-plugin-tp30764600p30764600.html
Sent from the JRuby - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
can you try it with moving that dependency into the top level.
regards, Kristian
[WARNING]
file:/Users/me/.m2/repository/org/jruby/jruby-complete/1.5.6/jruby-complete-1.5.6.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require': no such file to load -- zip/zip (LoadError)
I guess the part I don't understand is how the jruby-maven-plugin resolves
required gems that are provided as Maven dependencies?
--
View this message in context: http://old.nabble.com/Executing-ruby-script-with-a-%27require%27-via-jruby-maven-plugin-tp30764600p30764684.html
https://github.com/mkristian/jruby-maven-plugins/tree/next/gem-maven-plugin/src/it/exec-file
regards,
Kristian
regards Kristian
Many thanks to you Kristian for your excellent work on the maven plugins for
jruby! This will make it much easier to incorporate ruby scripts into Maven
projects.
:-)
--
View this message in context: http://old.nabble.com/Executing-ruby-script-with-a-%27require%27-via-jruby-maven-plugin-tp30764600p30774088.html