From ccb5141ae087fc035c6ebda150169e690ff0ff31 Mon Sep 17 00:00:00 2001 From: tbje Date: Tue, 5 Oct 2010 19:15:02 +0200 Subject: [PATCH] Allow specifying webdefault.xml for jetty. Useful on windows for fixing file locking issue. --- sbt_pending/src/main/scala/sbt/DefaultProject.scala | 2 ++ web/LazyJettyRun.scala.templ | 1 + web/WebApp.scala | 1 + 3 files changed, 4 insertions(+) diff --git a/sbt_pending/src/main/scala/sbt/DefaultProject.scala b/sbt_pending/src/main/scala/sbt/DefaultProject.scala index 22668a34e..a329b4406 100644 --- a/sbt_pending/src/main/scala/sbt/DefaultProject.scala +++ b/sbt_pending/src/main/scala/sbt/DefaultProject.scala @@ -387,6 +387,7 @@ abstract class BasicWebScalaProject extends BasicScalaProject with WebScalaProje def port = jettyPort def log = p.log def jettyEnv = jettyEnvXml + def webDefaultXml = jettyWebDefaultXml } /** This is the classpath used to determine what classes, resources, and jars to put in the war file.*/ def webappClasspath = publicClasspath @@ -420,6 +421,7 @@ abstract class BasicWebScalaProject extends BasicScalaProject with WebScalaProje def jettyPort: Int = JettyRunner.DefaultPort def jettyEnvXml : Option[File] = None + def jettyWebDefaultXml : Option[File] = None lazy val jettyReload = task { jettyInstance.reload(); None } describedAs(JettyReloadDescription) lazy val jettyRestart = jettyStop && jettyRun diff --git a/web/LazyJettyRun.scala.templ b/web/LazyJettyRun.scala.templ index d6ae7056e..bdf0e11ba 100644 --- a/web/LazyJettyRun.scala.templ +++ b/web/LazyJettyRun.scala.templ @@ -58,6 +58,7 @@ private object LazyJettyRun${jetty.version} extends JettyRun import c._ configureDefaultConnector(server, port) val webapp = new WebAppContext(war.absolutePath, contextPath) + webDefaultXml.foreach{webDefaultXml:File => webapp.setDefaultsDescriptor(webDefaultXml.toString)} def createLoader = { diff --git a/web/WebApp.scala b/web/WebApp.scala index 72633cb8f..00d9b77b0 100644 --- a/web/WebApp.scala +++ b/web/WebApp.scala @@ -103,6 +103,7 @@ trait DefaultJettyConfiguration extends JettyConfiguration def classpath: PathFinder def parentLoader: ClassLoader def jettyEnv: Option[File] + def webDefaultXml: Option[File] } abstract class CustomJettyConfiguration extends JettyConfiguration {