3

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

3 Answers 3

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.

2
  • 2
    FWIW, to make it slightly simpler you can just add to the defaults: config.public_html += FileList["META-INF/context.xml"]
    – Araxia
    Nov 23, 2011 at 18:26
  • You can accept your own answer by clicking the green tick. Jun 11, 2015 at 19:17
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"]
1
  • 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 6, 2011 at 23:06
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.