How to set berth contextPath on xsbt-web-plugin?

I am on sbt 0.11.1 and xsbt-web-plugin 0.2.10

here goes 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 that configurationXml is not working, after starting the container: start in the sbt console, contextPath gets the default value "/"

How can I change contextPath? any tips? thank you in advance!

+4
source share
1 answer

Here is a solution from scalatra-user group

Add jetty-plus to your 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 file:

 <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Set name="contextPath">/foo</Set> </Configure> 
+1
source

Source: https://habr.com/ru/post/1385615/


All Articles