While a similar question was asked more than half a year ago, I'm wondering what the best way to write JRuby code that's depending on gems but also depending on Maven projects. Bundler seems to be the standard Maven like tool for the Ruby community, and I'd prefer to use that, but it looks like bundler won't be supporting Maven dependencies.
Is gem install mvn:<groupId>:<artifactId>
the only real solution? Would I just put that into a Rakefile? Do people then do all their gem installations with rake instead of bundler? Does anyone have other suggestions of approaching this problem? Thank you.
I found my answer in jbundler. With jbundler you define a Mvnfile
, which looks similar to a Gemfile
, and put your Maven dependencies there.
repository 'http://your-local-repo-here/'
jar 'groupId:artifactId', '1.0.0-SNAPSHOT'
...
jbundler even works with locally installed (in your .m2/repository) jars, letting you integrate with your work-in-progress Java project.
Since it integrates with Bundler, there's no need to use another tool to pull down your Maven dependencies. Just bundle install; bundle exec something.rb
. Strangly, the Maven dependency resolution happens at bundle exec
time and not bundle install
, but I can live with that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With