3

How can I add META-INF/context.xml into the war? I didn't find any config entry in config/warble.rb.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Bewang
  • 453
  • 3
  • 18

3 Answers3

3

Unfortunately Nick's method doesn't work. The file is actually copied to WEB-INF/META-INF/context.xml.

I finally figure out a way to copy context.xml to META-INF:

  1. create META-INF/context.xml under your rails app root folder
  2. uncomment and change the following line in config/warble.rb

    config.public_html = FileList["public/**/*", "doc/**/*", "META-INF/context.xml" ]

Basically treat META-INF as public_html, and it will be copied to webapps/youapp/META-INF.

Bewang
  • 453
  • 3
  • 18
0

A better way of tackling this might be to use the following in your warble.rb file.

config.script_files << 'path_to_file/context.xml'

See documentation towards bottom of https://github.com/jruby/warbler/blob/master/lib/warbler/config.rb

# These file will be placed in the META-INF directory of the jar or war that warbler
# produces. They are primarily used as launchers by the runnable feature.
attr_accessor :script_files
eric gray
  • 1
  • 1
0

You'll have to add one yourself. You can either create a META-INF/context.xml directory and file in your project and add META-INF to config.dirs in config/warble.rb or you can add a "pathmap" to rename the context.xml file into the META-INF directory in the war file.

config.pathmaps.application += ["%{context.xml,META-INF/context.xml}p"]
Nick Sieger
  • 3,315
  • 20
  • 14
  • 1
    The above method doesn't work. The file is actually copied to WEB-INF/META-INF/context.xml. I finally figure out a way to copy context.xml to META-INF: 1. create META-INF/context.xml under your rails app root folder 2. uncomment and change the following line in config/warble.rb config.public_html = FileList["public/**/*", "doc/**/*", "META-INF/context.xml" ] Basically treat META-INF as public_html, and it will be copied to webapps/youapp/META-INF. – Bewang Apr 06 '11 at 23:06