Search code examples
jrubyjrubyonrails

Jruby rails - where should the java code go?


In my rails application I need to write some custom Java classes, so just wondering if there's any guidelines/best practice on how to structure the project repository? I mean like rails have a default directory structure in place, like app, models etc..., what should be the best place for my custom Java code?


Solution

  • I don't think there's a standard recommended practice, but there are a few options:

    • ruby-maven provides a DSL and a set of Rake plugins to build Java code the Maven way.
    • jruby-gradle-plugin provides similar support for the Gradle build tool.
    • For managing dependency libraries, there's also jar-dependencies.

    If you're going to start writing Java/JVM code to go with your app, you'll probably need to integrate with the rest of the Java ecosystem at some point, and these tools are designed to support that.