4

I'm on sbt 0.11.1 and xsbt-web-plugin 0.2.10

here goes the build.sbt and 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"))

It seems the configurationXml doesn't work, after running container:start in sbt console, the contextPath gets the default value "/"

how can I change the contextPath? any tips? thanks in advance!

Septem
  • 3,614
  • 1
  • 20
  • 20
  • I got an answer on scalatra-user group, please refer: http://groups.google.com/group/scalatra-user/browse_thread/thread/cc3883be7d01d61f – Septem Dec 11 '11 at 04:16
  • You are allowed to anser your own question. Why not including the answer from the mailinglist here as answer to your problem to document the solution in place? – Steffen Dec 11 '11 at 08:59
  • I think [you can answer your own question now](http://meta.stackexchange.com/questions/132886/what-is-this-answer-your-own-question-jazz) with just a little reputation. – Bluu Jul 20 '12 at 00:37
  • To enable `configurationXml`, `customConfiguration` parameter should be set to true, otherwise it is not applied. However, I couldn't manage it to work due to issues with classpath, etc, and not found any samples of working `configurationXml`. It replaces configuration done by xsbt-web-plugin completely, so everything must be configured from scratch: connectors, context handler, classpath. – kolen Oct 23 '12 at 18:17

1 Answers1

1

Here's a solution from scalatra-user group

Add jetty-plus to dependencies:

"org.eclipse.jetty" % "jetty-plus" % "7.4.5.v20110725" % "container"

Add this to build.sbt:

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

In the same directory as build.sbt, create the jetty-env.xml:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/foo</Set>
</Configure>
Septem
  • 3,614
  • 1
  • 20
  • 20