sbt web插件:使用configurationXml指定jetty的类路径

sbt web插件:使用configurationXml指定jetty的类路径,jetty,sbt,xsbt-web-plugin,Jetty,Sbt,Xsbt Web Plugin,我试图在使用sbt web插件时为jetty创建自定义配置(用于运行容器:start)。允许指定自定义jetty xml配置:configurationFiles和configurationXml(当customConfiguration为true时) 然而,这完全覆盖了由sbt web插件完成的jetty的内部配置,所以定制配置应该完全配置jetty。如果不为从项目编译的.class文件和依赖项指定类路径,它将无法工作 我正在尝试这样做: configurationXml in contain

我试图在使用sbt web插件时为jetty创建自定义配置(用于运行
容器:start
)。允许指定自定义jetty xml配置:
configurationFiles
configurationXml
(当
customConfiguration
为true时)

然而,这完全覆盖了由sbt web插件完成的jetty的内部配置,所以定制配置应该完全配置jetty。如果不为从项目编译的.class文件和依赖项指定类路径,它将无法工作

我正在尝试这样做:

configurationXml in container.Configuration <<= fullClasspath (
  <Configure id="Server" class="org.eclipse.jetty.server.Server">
    ...
    <Set name="handler">
      <New class="org.eclipse.jetty.webapp.WebAppContext">
        <Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/src/main/webapp</Set>
        <Set name="descriptor"><SystemProperty name="jetty.home" default="."/>/src/main/webapp/WEB-INF/web.xml</Set>
        <Set name="contextPath">/</Set>
        <Set name="extraClasspath">{/* classpath should be here */}</Set>
      </New>
    </Set>
    ...
  </Configure>
)

configurationXml in container.Configuration您可以使用
env
设置自定义
WebAppContext

env in Compile := Some(file(".") / "jetty-env.xml" asFile)

例如,在MyStudio/JeTytEnv.XML:

中考虑以下内容

/习俗

这将在上下文路径/自定义下部署您的webapp,但不会更改基础
服务器的任何配置

env
设置记录在何处?您可以在中找到它,但它非常陈旧且不推荐使用。我将研究在2.1版中更新它。
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/custom</Set>
</Configure>