sbt web插件:使用configurationXml指定jetty的类路径
我试图在使用sbt web插件时为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
容器: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>