Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing JRuby code that depends on gems and Maven projects

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.

like image 288
Arthur Maltson Avatar asked May 18 '12 17:05

Arthur Maltson


1 Answers

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.

like image 179
Arthur Maltson Avatar answered Oct 19 '22 08:10

Arthur Maltson