3

如何将 META-INF/context.xml 添加到战争中?我在 config/warble.rb 中没有找到任何配置条目。

4

3 回答 3

3

不幸的是,尼克的方法不起作用。该文件实际上被复制到WEB-INF/META-INF/context.xml。

我终于找到了一种将 context.xml 复制到 META-INF 的方法:

  1. 在您的 rails 应用程序根文件夹下创建 META-INF/context.xml
  2. 取消注释并更改 config/warble.rb 中的以下行

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

基本上把 META-INF 当作 public_html,它会被复制到 webapps/youapp/META-INF。

于 2011-04-06T23:13:41.707 回答
0

解决此问题的更好方法可能是在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
于 2014-01-23T14:58:52.137 回答
0

您必须自己添加一个。您可以META-INF/context.xml在项目中创建目录和文件并添加META-INF到其中config.dirsconfig/warble.rb也可以添加“路径图”以将 context.xml 文件重命名为 war 文件中的 META-INF 目录。

config.pathmaps.application += ["%{context.xml,META-INF/context.xml}p"]
于 2011-03-17T18:11:10.003 回答