rbenv,JRuby,Warble,Rake

时间:2011-12-12 21:37:39

标签: tomcat rake jrubyonrails warbler

我有JRuby网络应用程序,它在部署框上的Tomcat服务器上运行。我使用Warble将其打包成WAR文件,并部署在我也安装了JRuby的服务器上。我在开发框和部署框上运行rbenv和JRuby 1.6.4。

My Gemfile如下所示:

source 'http://rubygems.org'
gem 'rails', '3.0.10'
gem 'rake', '0.8.7'
gem 'jquery-rails'
gem 'rest-client', '~> 1.6.7'


platforms :mri do
gem 'mysql2', '~> 0.2.11'
end


platforms :jruby do 
gem 'jruby-openssl'
gem 'activerecord-jdbcmysql-adapter'
gem 'warbler'
end

我想运行一些自定义Rake任务。当我在我使用的开发环境(“rails server”)中运行我的rake任务时,它工作正常(我使用rbenv,“rails server”确实调用JRuby 1.6.4,并运行“bundle exec rake abc:帮助“)。

我的本​​地宝石列表如下所示:

user@ubuntu:~/abc$ gem list --local

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.10)
actionpack (3.0.10)
activemodel (3.0.10)
activerecord (3.0.10)
activerecord-jdbc-adapter (1.2.0)
activerecord-jdbcmysql-adapter (1.2.0)
activeresource (3.0.10)
activesupport (3.0.10)
arel (2.0.10)
bouncy-castle-java (1.5.0146.1)
builder (2.1.2)
bundler (1.0.21)
erubis (2.6.6)
i18n (0.5.0)
jdbc-mysql (5.1.13)
jquery-rails (1.0.16)
jruby-jars (1.6.4)
jruby-openssl (0.7.4)
jruby-rack (1.0.10)
json (1.6.1 java)
mail (2.2.19)
mime-types (1.16)
polyglot (0.3.2)
rack (1.2.4)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.10)
railties (3.0.10)
rake (0.9.2, 0.8.7)
rdoc (3.11)
rest-client (1.6.7)
rubyzip (0.9.4)
thor (0.14.6)
treetop (1.4.10)
tzinfo (0.3.30)
warbler (1.3.2)
user@ubuntu:~/abc$ 

当应用程序位于Tomcat tomcat / webapps / abc / *的单独框中时(由Tomcat爆炸),然后我转到根目录,我得到以下内容:

jgodse@host:~.../webapps/abc/WEB-INF$ bundle exec rake bcp:help --trace
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/home/jgodse/.rbenv/versions/jruby-1.6.4/lib/ruby/gems/1.9/gems/rake-0.8.7/lib/rake.rb:2377:in `raw_load_rakefile'
/home/jgodse/.rbenv/versions/jruby-1.6.4/lib/ruby/gems/1.9/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/home/jgodse/.rbenv/versions/jruby-1.6.4/lib/ruby/gems/1.9/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/jgodse/.rbenv/versions/jruby-1.6.4/lib/ruby/gems/1.9/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/home/jgodse/.rbenv/versions/jruby-1.6.4/lib/ruby/gems/1.9/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/home/jgodse/.rbenv/versions/jruby-1.6.4/lib/ruby/gems/1.9/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/jgodse/.rbenv/versions/jruby-1.6.4/lib/ruby/gems/1.9/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/jgodse/.rbenv/versions/jruby-1.6.4/lib/ruby/gems/1.9/gems/rake-0.8.7/bin/rake:31:in `(root)'
org/jruby/RubyKernel.java:1073:in `load'
/home/jgodse/.rbenv/versions/jruby-1.6.4/lib/ruby/gems/1.9/bin/rake:19:in `(root)'
jgodse@host:~.../webapps/abc/WEB-INF$ 

我的本​​地gem列表在部署框中看起来像这样(Rails应用程序部署在WAR文件中)。

jgodse@host:~/webapps/abc/WEB-INF$ gem list --local
abstract (1.0.0)
actionmailer (3.0.10)
actionpack (3.0.10)
activemodel (3.0.10)
activerecord (3.0.10)
activerecord-jdbc-adapter (1.2.0)
activerecord-jdbcmysql-adapter (1.2.0)
activeresource (3.0.10)
activesupport (3.0.10)
arel (2.0.10)
bouncy-castle-java (1.5.0146.1)
builder (2.1.2)
bundler (1.0.21)
erubis (2.6.6)
i18n (0.5.0)
jdbc-mysql (5.1.13)
jquery-rails (1.0.16)
jruby-jars (1.6.4)
jruby-openssl (0.7.4)
jruby-rack (1.0.10)
json (1.6.1 java)
mail (2.2.19)
mime-types (1.17.2, 1.16)
polyglot (0.3.2)
rack (1.2.4)
rack-mount (0.6.14)    
rack-test (0.5.7)
rails (3.0.10)
railties (3.0.10)
rake (0.9.2.2, 0.8.7)
rdoc (3.11) 
rest-client (1.6.7)
rubyzip (0.9.4)
thor (0.14.6)
treetop (1.4.10)
tzinfo (0.3.30)
warbler (1.3.2)
jgodse@host:~/webapps/abc/WEB-INF$ 

为了让我的rake任务耗尽我的爆炸WAR文件目录,我缺少什么?

另外,我使用Rake 0.8.7因为0.9.2让我感到悲伤。

1 个答案:

答案 0 :(得分:2)

默认情况下,Warbler不包含您的Rakefile,因此您必须将其添加到config/warble.rb。 (如果您还没有文件,请使用warble config生成文件。)