Forum: JRuby Packaging Gems in a Jar File

486ca04f06d968004643ce5b47376ded?d=identicon&s=25 Keith B. (keith_b)
on 2013-07-15 22:50
(Received via mailing list)
Sorry, I'll add the subject line now. ;)

- Keith
A8f7c2b66fafa83e9537c1f82348f11d?d=identicon&s=25 Doug Hathaway (Guest)
on 2013-07-15 22:57
(Received via mailing list)
Have you looked into bundler <http://bundler.io/>?
This gem allows you to create a gemfile that lists all the dependent
gems.
"bundle install" will install all the required gems
You can also download and store these gems within the project locally
with
the "bundle package" command, in turn you can install those gems with
the
"bundle install --local" command.
748797a1a0dc3de4c50e722d90589129?d=identicon&s=25 Rhett Sutphin (Guest)
on 2013-07-15 22:58
(Received via mailing list)
Hi Keith,

I wrote an packaging extension for buildr which helps you bundle up a
collection of gems in a JAR in a way that JRuby can use them:

https://github.com/NUBIC/buildr-gemjar

Even if you don't want to use the packager itself, the README describes
some
snags you might run into.

Rhett


From:  Keith Bennett <keithrbennett@gmail.com>
Reply-To:  <user@jruby.codehaus.org>
Date:  Monday, July 15, 2013 3:46 PM
To:  <user@jruby.codehaus.org>
Subject:  [jruby-user] Packaging Gems in a Jar File

Sorry, I'll add the subject line now. ;)

- Keith


On Mon, Jul 15, 2013 at 4:45 PM, Keith Bennett <keithrbennett@gmail.com>
2cda9758c673339fc208518b9756479b?d=identicon&s=25 Colin Surprenant (Guest)
on 2013-07-15 23:41
(Received via mailing list)
Nice work Rhett! I also have done similar work in RedStorm
https://github.com/colinsurprenant/redstorm to package gems into a
jar, but it is not a standalone process. My strategy was to use
Bundler for dependency resolution and copy the bundled gems into the
jar. I will take a look at your strategy and see if we can
iterate/improve with this.

Colin

On Mon, Jul 15, 2013 at 4:55 PM, Rhett Sutphin <rhett.sutphin@gmail.com>
wrote:
> Rhett
> - Keith
>> Second best would be to ship the script itself, plus another file containing
>> of where the script is installed, and using that.
>>
>> Thanks for any help.
>>
>> - Keith
>>
>



--
@colinsurprenant
748797a1a0dc3de4c50e722d90589129?d=identicon&s=25 Rhett Sutphin (Guest)
on 2013-07-15 23:51
(Received via mailing list)
Hi Colin,

I think using bundler as part of the process is a great idea. I would
have
used it when I first wrote buildr-gemjar (in 2011), except I had a
requirement to be able to use locally-packaged .gem files. Bundler has
never directly supported this, but there is apparently a workaround you
can use now[1].

Anyway, I wrote up a bunch of notes about how I'd rework buildr-gemjar
to
use bundler[2], but I haven't had a chance to implement any of them yet.

Rhett

[1]: https://github.com/carlhuda/bundler/issues/1879
[2]: https://github.com/NUBIC/buildr-gemjar/issues/5
D565139dbbafc06e7daf4826ca0f0228?d=identicon&s=25 R. Tyler Croy (Guest)
on 2013-07-16 01:47
(Received via mailing list)
Attachment: signature.asc (197 Bytes)
On Mon, 15 Jul 2013, Keith Bennett wrote:

> > http://yokolet.blogspot.com/2010/10/gems-in-jar-wi..., but
> > it looks like it requires some coding, and I'm wondering if there's a yet
> > easier way to do it.
> >
> > What's the best way to do this these days?  If necessary, he may just fall
> > back to creating a custom gem home somewhere, maybe in a gems subdirectory
> > of where the script is installed, and using that.



Is using warbler not an option? I've been using warbler to create
stand-alone
jars for a while now and it works great.


I'm struggling to find the time to write up a good blog post on what
I've been
working on, but providing self-contained runnable jars has simplified a
*lot*
for my team :)

- R. Tyler Croy
486ca04f06d968004643ce5b47376ded?d=identicon&s=25 Keith B. (keith_b)
on 2013-07-16 19:40
(Received via mailing list)
Guys -

Thanks for all your input.  It didn't occur to me to use warbler,
because
for some reason I thought it was specific to Rails.

We're aware of Bundler, and have been using it ourselves.  This use case
is
different though, as it involves distributing  software to a Java shop
with
little to no Ruby expertise, so they were hoping to reduce the entire
distribution to a single jar file.

However, I suspect that that might not be viable, because any gems we
package in the jar file will be built on a particular system.  Although
JRuby gems are in general written in JRuby, they can contain references
to
native code, right?  Or even contain native code?

Thanks again,
Keith
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.