Here are the basic steps to create a war file from a Rails application. This is what Warbler does.
-
Make a staging directory to create the structure, and make a WEB-INF directory in side of that.
-
Copy your application code into the WEB-INF directory.
%w(app config lib vendor).each {|d| cp_r d, web_inf_dir }
-
Copy your public assets into the root of the staging directory.
FileList["public/**/*"].each {|f| cp f, File.join(staging_dir, f.sub(%r{public/}, '')) }
-
Create a
WEB-INF/web.xml
file. Example contents follows. -
Copy the
jruby-core
andjruby-stdlib
jars from thejruby-jars
gem intoWEB-INF/lib
. -
Copy the
jruby-rack
jar intoWEB-INF/lib
. -
Jar the whole thing up.
jar cf myapp.war -C staging_dir .
There are details around configuring gems, customizing web.xml, and specifying additional libraries in the war file, and Warbler's configuration helps with that.