【问题标题】:How to specify a jetty.xml config file for xsbt-web-plugin如何为 xsbt-web-plugin 指定 jetty.xml 配置文件
【发布时间】:2015-02-11 12:30:37
【问题描述】:

我有一个使用 xsbt-web-plugin 的项目,但我希望能够自定义码头设置。有没有办法可以指定我自己的 jetty.xml 文件?我找到了

PluginKeys.configurationFiles

设置并将其设置为所需的文件,但没有效果

【问题讨论】:

    标签: scala scalatra xsbt-web-plugin


    【解决方案1】:

    您可以使用 config 参数指定 jetty.xml 配置文件到 jetty()

    jetty(config = "etc/jetty.xml")
    

    如果您需要指定多个配置文件,您可以将它们作为单独的--config 参数传递:

    jetty(args = Seq
        "--config", "jetty.xml"
      , "--config", "jetty-https.xml"
      , "--config", "jetty-ssl.xml"
    ))
    

    查看the docs 了解更多信息。

    【讨论】:

    • 但这是针对 build.sbt 的。如果我有 build.scala 文件怎么办?
    • 对于一个Build.scala文件,可以将其添加到Projectsettingslazy val myProj = Project(..., settings = Seq(...) ++ com.earldouglas.xwp.XwpPlugin.jetty(config = ...))
    • 我已经用上面的full-configuration example 更新了自述文件。
    • 我在 scalatra 项目中使用它,无法获得 1.0.0 版本来使用 scalatra 进行编译。见:stackoverflow.com/questions/25991296/…
    【解决方案2】:

    我目前使用的是xsbt-web-plugin 2.0.2(最新版本)。你可以在build.sbt中做如下:

    enablePlugins(JettyPlugin) 
    containerConfigFile in Compile := Some(file("./src/main/webapp/WEB-INF/jetty-env.xml"))
    

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 2014-12-19
      • 2013-06-20
      • 1970-01-01
      • 2016-06-17
      • 2014-04-14
      • 1970-01-01
      • 1970-01-01
      • 2021-07-03
      • 1970-01-01
      相关资源
      最近更新 更多