【发布时间】:2011-07-17 06:12:39
【问题描述】:
如何将 META-INF/context.xml 添加到战争中?我在 config/warble.rb 中没有找到任何配置条目。
【问题讨论】:
标签: warbler context.xml meta-inf
如何将 META-INF/context.xml 添加到战争中?我在 config/warble.rb 中没有找到任何配置条目。
【问题讨论】:
标签: warbler context.xml meta-inf
您必须自己添加一个。您可以在项目中创建一个META-INF/context.xml 目录和文件,并将META-INF 添加到config/warble.rb 中的config.dirs,或者您可以添加一个“路径图”以将context.xml 文件重命名为META-INF 目录中的战争文件。
config.pathmaps.application += ["%{context.xml,META-INF/context.xml}p"]
【讨论】:
很遗憾,尼克的方法不起作用。该文件实际上是复制到WEB-INF/META-INF/context.xml。
我终于找到了一种将 context.xml 复制到 META-INF 的方法:
取消注释并更改 config/warble.rb 中的以下行
config.public_html = FileList["public/**/*", "doc/**/*", "META-INF/context.xml" ]
基本把META-INF当作public_html,会复制到webapps/youapp/META-INF。
【讨论】:
config.public_html += FileList["META-INF/context.xml"]
解决此问题的更好方法可能是在您的 warble.rb 文件中使用以下内容。
config.script_files << 'path_to_file/context.xml'
查看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
【讨论】: