How to include the ruport/acts_as_reportable gems for JRuby using Warbler?
I am using JRuby 1.4.0 and want to use Ruport to make CSV files. This perfectly works until I make a war-file from it with warbler to put it on a server.
When I add the following code to environment.rb, JRuby complains there is No such file to load -- 'ruport'
config.after_initialize do
require 'ruport'
require 'ruport/acts_as_reportable'
end
It works perfect locally, since I installed ruport and acts_as_reportable through gem install ...
, but now I want to do it on a tomcat server and I've heard you can just add them to your gems folder to use it (does this need installation/configuration?).
I also added the needed gems with dependencies to the warble adding the following lines to warble.rb:
config.gems = ["ruport", "acts_as_reportable", "activerecord-oracle_enhanced-adapter", "rails", "rack"]
It still gives the same problem. All I found googling is the you should add config.gem 'acts_as_reportable', :lib => 'ruport/acts_as_reportable开发者_StackOverflow'
to warble.rb, since the AAR gem is required that way. The problem is my JRuby version is only 1.4.0 and complains config.gem is a private method call and this only seems to work with more recent versions of JRuby.
Thanks!
Warbler is based on jruby-rack . You might want to review the gem.path setting
inside the web.xml file. I copy pasted the description from jruby-rack JRuby-Rack Configuration
section below.
gem.path: Relative path to the bundled gem repository. Defaults to /WEB-INF/gems.
You get your app run inside Tomcat with just jruby-rack by following the jruby-rack documentation, if you are comfortable with Tomcat and the concept of webapps.
精彩评论