Simplify working with java dependencies.
You need to meet the following requirements:
- Running with jruby
- Mavenized Project
- Specify your java dependencies in a pom.xml (same as you would a java maven project)
- Add the following lines to an intializer or spec_helper
- Smile because your java dependencies are loaded onto your classpath when you start your app
gem install pom-loader
require 'pom-loader'
pom_dir = File.expand_path("../../", __FILE__) # The dir that contains your pom.xml file
mvn = ENV['MVN2_EXE'] || 'mvn' # Your maven executable
PomLoader.load(pom_dir: pom_dir, mvn_exe: mvn)
$! = nil # unset evil magic bit
-- PomLoader will cause the ruby process to:
- parse the pom.xml file
- figure out and load all jar dependencies.
- Setup the log4j context if target/classes/com/homeaway/log4j.xml exists
- Setup Java system properties for every property parsed from the jetty plugin system properties.
We've provided a rake task that will gather/install all of your java dependencies for your jruby project. Inside of your project's rakefile simply add:
require 'pom-loader/tasks'
And now when you 'rake -T' you should see:
...
rake pom_loader:load # Generate and gather all of the files required for PomLoader
...
Apache License version 2.0