我使用的是sbt 0.11.1和xsbt-web-plugin 0.2.10
这就是build.sbt和plugins.sbt
build.sbt
organization := "org"
name := "demo"
version := "0.1.0-SNAPSHOT"
scalaVersion := "2.9.1"
seq(webSettings :_*)
configurationXml :=
<configuration>
<webApp>
<contextPath>/foo</contextPath>
</webApp>
</configuration>
libraryDependencies ++= Seq(
"org.eclipse.jetty" % "jetty-webapp" % "7.4.5.v20110725" % "container",
"javax.servlet" % "servlet-api" % "2.5" % "provided"
)
resolvers += "Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"project/plugins.sbt
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.10"))configurationXml似乎不工作,在sbt控制台运行container:start后,contextPath得到默认值"/“
如何更改contextPath?有什么建议吗?提前感谢!
发布于 2013-07-02 10:39:42
以下是来自scalatra用户组的解决方案
将jetty-plus添加到依赖项:
"org.eclipse.jetty" % "jetty-plus" % "7.4.5.v20110725" % "container"将此代码添加到build.sbt:
env in Compile := Some(file(".") / "jetty-env.xml" asFile)在与build.sbt相同的目录中,创建jetty-env.xml:
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/foo</Set>
</Configure>https://stackoverflow.com/questions/8453524
复制相似问题