使用warbler生成war文件

时间:2016-12-08 08:49:06

标签: sinatra jruby warbler

我正在尝试使用warbler为jruby生成war文件,但是我遇到了这个错误:

warble aborted!
NoMethodError: undefined method `booter=' for nil:NilClass
config/warble.rb:9:in `block in initialize' /Users/xxx/.rvm/gems/jruby-9.0.5.0/gems/warbler-2.0.4/lib/warbler/config.rb:216:in `initialize'
config/warble.rb:4:in `<eval>' 
/Users/xxx/.rvm/gems/jruby-9.0.5.0/gems/warbler-2.0.4/lib/warbler/task.rb:46:in `initialize'
/Users/xxx/.rvm/gems/jruby-9.0.5.0/gems/warbler-2.0.4/lib/warbler/application.rb:27:in `load_rakefile' 
/Users/xxx/.rvm/gems/jruby-9.0.5.0/gems/warbler-2.0.4/lib/warbler/application.rb:79:in `run'
/Users/xxx/.rvm/gems/jruby-9.0.5.0/gems/warbler-2.0.4/lib/warbler/application.rb:74:in `run' 
/Users/xxx/.rvm/gems/jruby-9.0.5.0/gems/warbler-2.0.4/bin/warble:11:in `<top>'
/Users/xxx/.rvm/gems/jruby-9.0.5.0/bin/warble:23:in `<top>'
(See full trace by running task with --trace)

我在config / warble.rb中的配置文件:

Warbler::Config.new do |config|
  config.dirs = %w(app config views)
  config.gems += ["sinatra"]
  config.gems -= ["rails"]
  config.jar_name = "jsinatra"
  config.webxml.booter = :rack
  config.webxml.jruby.compat.version = "1.9"
  config.webxml.rackup.path = '/WEB-INF/config.ru'
end

任何帮助,建议apricciated。谢谢。

总而言之,我正在尝试创建docker容器,我正在使用pdf文件作为参考,但pdf在某种程度上是模糊的。 http://www.ibm.com/developerworks/cloud/library/cl-sinatra-softlayer-app/cl-sinatra-softlayer-app-pdf.pdf

1 个答案:

答案 0 :(得分:0)

Worked for me

In the pdf I posted there is file named rackup.ru with this contents:

require "sinatra"
require File.dirname(__FILE__) + '/app/main'
run MyApp

After hours of googling, I decided to create identical file and name it config.ru. Worked.

Not working

I have also tried to change

config.webxml.rackup.path = '/WEB-INF/config.ru'

to

config.webxml.rackup.path = '/WEB-INF/rackup.ru'

Did not work.