I trying to create custom configuration for jetty when using sbt-web-plugin (for running with container:start
). There are two container settings allowing to specify custom jetty xml configuration: configurationFiles
and configurationXml
(when customConfiguration
is true).
However, this overrides internal configuration of jetty done by sbt-web-plugin completely so custom config should configure jetty fully. And it will not work without specifying classpath to .class files compiled from project and to dependencies.
I trying to do something like that:
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>
)
Seems that direct dependency of configurationXml
on fullClasspath
is not possible, because configurationXml
is SettingKey
and fullClasspath
is TaskKey
:
The practical importance of this is that you can't have tasks as dependencies for a non-task setting.
Is it possible to include fullClasspath
setting in configurationXml
parameter?
If not, is it still possible to add custom configuration settings to jetty development server invoked on container:start
?
You can customize just the
WebAppContext
using theenv
setting:For example, consider the following in myproject/jetty-env.xml:
This will deploy your webapp under the context path /custom, but won't change any configuration of the underlying
Server
.