开发者

How to add META-INF/context.xml in Warbler

开发者 https://www.devze.com 2023-02-17 04:25 出处:网络
How can I add META-INF/context.xml into the war? I didn\'t find any config entry in config开发者_开发知识库/warble.rb.Unfortunately Nick\'s method doesn\'t work. The file is actually copied to WEB-INF

How can I add META-INF/context.xml into the war? I didn't find any config entry in config开发者_开发知识库/warble.rb.


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.


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"]


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号