On Tue, Mar 10, 2009 at 7:49 PM, Roy Tinker <[email protected]> wrote:
> Hello, > > I am looking to find a way to package Buildr as a single Jar file, to be > run > alongside the jruby-complete-1.2.0RC2.jar file. Our current system (running > on Ant -- I'm trying to move to Buildr) downloads the executables (Jar and > Ant-XML) from source control and runs them on the JVM on a local machine > (which could be anywhere in the company). You can imagine how inconvenient > it would be to store all of 100 or more files associated with Buildr in > source control. It would be so much easier to have it all located inside a > single Jar file. > > Nick Sieger has found a way of packaging gems as jars for JRuby -- see > http://blog.nicksieger.com/articles/2009/01/10/jruby-1-1-6-gems-in-a-jar > *Note*: Unfortunately this technique does not yet work with gems that include Java code in embedded jar files (e.g., hpricot, mongrel, jruby-openssl). See JRUBY-3299 <http://jira.codehaus.org/browse/JRUBY-3299>. (We’d like to get this fixed for 1.1.7, but could use your help.) JRUBY 3229 is still open, and we do use jruby-openssl, so you should see Buildr failing when it tries to load that library. However, it not finding bin/buildr sounds to me like a JRuby bug: $ unzip -l buildr-gem.jar | head Archive: buildr-gem.jar Length Date Time Name -------- ---- ---- ---- 0 03-10-09 23:01 META-INF/ 60 03-10-09 23:01 META-INF/MANIFEST.MF 0 03-10-09 22:56 bin/ 344 03-10-09 22:55 bin/autospec 344 03-10-09 22:56 bin/buildr 371 03-10-09 22:55 bin/minitar 338 03-10-09 22:54 bin/rake $ jruby -rbuildr-gem.jar -S autospec /bin/sh: autotest: command not found $ jruby -rbuildr-gem.jar -S buildr buildr:1: undefined method `buildr' for JRuby::Commands:Class (NoMethodError) $ jruby -rbuildr-gem.jar -S minitar file:/Users/assaf/work/test/buildr-gem.jar!/gems/archive-tar-minitar-0.5.2/bin/minitar:19: undefined method `require_gem' for main:Object (NoMethodError) from file:/Users/assaf/work/test/buildr-gem.jar!/gems/archive-tar-minitar-0.5.2/bin/minitar:19:in `load' from /opt/local/share/java/jruby/bin/minitar:19 (I have minitar installed separately, so it picks the bin from outside the JAR) Assaf > Has anyone done this before? -- or, does anyone have an idea of where I can > start? > > Here's what I have tried so far (with help from Nick's blog post) -- this > is > a transcript of my session. > > F:\jruby>java -jar jruby-complete-1.2.0RC2.jar -S gem list > > > > *** LOCAL GEMS *** > > > > rake (0.8.4) > > rspec (1.1.12) > > sources (0.0.1) > > > > F:\jruby>java -jar jruby-complete-1.2.0RC2.jar -S gem install -i ./buildr > > buildr --no-rdoc --no-ri > > JRuby limited openssl loaded. gem install jruby-openssl for full support. > > http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL > > Successfully installed rake-0.8.1 > > Successfully installed builder-2.1.2 > > Successfully installed net-ssh-2.0.4 > > Successfully installed net-sftp-2.0.1 > > Successfully installed rubyzip-0.9.1 > > Successfully installed highline-1.4.0 > > Successfully installed rubyforge-1.0.0 > > Successfully installed hoe-1.7.0 > > Successfully installed Antwrap-0.7.0-java > > Successfully installed rspec-1.1.5 > > Successfully installed xml-simple-1.0.11 > > Successfully installed archive-tar-minitar-0.5.2 > > Successfully installed jruby-openssl-0.2 > > Successfully installed buildr-1.3.3-java > > 14 gems installed > > > > F:\jruby>jar cf buildr-gem.jar -C buildr . > > > > F:\jruby>dir > > Volume in drive F is DATA > > Volume Serial Number is ____-____ > > > > Directory of F:\jruby > > > > 03/10/2009 07:41 PM <DIR> . > > 03/10/2009 07:41 PM <DIR> .. > > 03/06/2009 10:33 PM 279 build.rb > > 03/10/2009 07:40 PM <DIR> buildr > > *03/10/2009 07:42 PM 7,545,144 buildr-gem.jar* > > 03/09/2009 10:42 AM 10,279,665 jruby-complete-1.2.0RC2.jar > > 3 File(s) 17,825,088 bytes > > 3 Dir(s) 156,998,463,488 bytes free > > > > F:\jruby>java -jar jruby-complete-1.2.0RC2.jar -rbuildr-gem.jar -S gem > list > > > > *** LOCAL GEMS *** > > > > Antwrap (0.7.0) > > archive-tar-minitar (0.5.2) > > builder (2.1.2) > > buildr (1.3.3) > > highline (1.4.0) > > hoe (1.7.0) > > jruby-openssl (0.2) > > net-sftp (2.0.1) > > net-ssh (2.0.4) > > rake (0.8.4, 0.8.1) > > rspec (1.1.12, 1.1.5) > > rubyforge (1.0.0) > > rubyzip (0.9.1) > > sources (0.0.1) > > xml-simple (1.0.11) > > > > F:\jruby>java -jar jruby-complete-1.2.0RC2.jar -rbuildr-gem.jar -S buildr > > jruby: No such file, directory, or command -- buildr > > > > F:\jruby>java -jar jruby-complete-1.2.0RC2.jar -rbuildr-gem.jar build.rb > > build.rb:3:in `require': no such file to load -- buildr (LoadError) > > from build.rb:3 > > > > F:\jruby>java -jar jruby-complete-1.2.0RC2.jar -rbuildr-gem.jar -S irb > > irb(main):002:0> require 'rubygems' > > => true > > irb(main):003:0> require 'buildr' > > LoadError: no such file to load -- buildr > > from > > > file:/F:/jruby/jruby-complete-1.2.0RC2.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31: > > in `require' > > from > > > file:/F:/jruby/jruby-complete-1.2.0RC2.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31: > > in `require' > > from (irb):4 > > > > > Thanks, > Roy >
