rubyrubygemsjrubywarbler

JRuby & Warbler - Include gem?


How to include gem(timers) in warbler jar?

App structure:

/myapp/bin/myapp content:

 require 'timers' 
 timers = Timers::Group.new
 five_second_timer = timers.after(5) { puts "Take five" }

Warbler build output:

 $ warble jar
 rm -f myapp.jar
 Creating myapp.jar
 $ 

java -jar myapp.jar output:

 LoadError: no such file to load -- timers

(...)


Solution

  • Try using bundler

    gem install bundler
    

    Create the file Gemfile at the root of your project and write the dependencies on it:

    gem 'timers'
    

    Now warbler will add the dependencies correctly.