Re: [jruby-user] How to use custom class files in Rails?
Ariel Valentin <[email protected]> Sun, 9 Nov 2014 14:16:02 -0500
| Newsgroups | gmane.comp.lang.jruby.user |
|---|---|
| Message-ID | <CAKthdGh4o+9FgLxM0TubpE4P9ax50CxpiY-G-R--Nozquki5Cg@mail.gmail.com> |
I don't have a "right" answer for you, but I what I can share with you is what has worked for me. My team uses torquebox and sinatra for our web services. We started by just directly interacting with Java APIs in our Ruby classes but kept bumping into issues with exception handling and type errors. When it comes time to deal with incompatible library upgrades, some of the APIs are so complex I felt like we were rewriting the application. We have now tried minimizing/isolating all of our interactions with Java code in our application. We started writing custom java code that provides a narrow interface in order to expose the functionality we need and then package it up into a shaded jar with dependencies. As far as delivery is concerned, we used to just deploy the shaded jars in vendor/jars but again ran into some issues with respect to managing those libraries. A few months ago we decided to move our application functionality into gems and deliver the shaded jars as part of those gems. We hope to take advantage of the jar-dependencies project someday but haven't tried it yet. We also haven't tried writing custom JRuby extensions so I don't have any feed back there. HTH Ariel Valentin e-mail: [email protected] website: http://blog.arielvalentin.com skype: ariel.s.valentin twitter: arielvalentin linkedin: http://www.linkedin.com/profile/view?id=8996534 --------------------------------------- *simplicity *communication *feedback *courage *respect On Sun, Nov 9, 2014 at 1:41 PM, David Maxwell <[email protected]> wrote: > I am using some custom jars in a JRuby on Rails project. All I'm doing > is putting them into the /lib directory and then requiring java and > importing them via my models, etc. > > The problem is that I want to do something more complex with these jars > than what I'm capable of with JRuby - I need to be able to write pure > java code to interact with them properly. > > So what if I want to have a central .class file or something which I > call from my model, which then interacts with the jars? Is this > possible? Do I need to add my custom class file to one of the jars? > > -- > Posted via http://www.ruby-forum.com/. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > >