Skip to content

Instantly share code, notes, and snippets.

@noelwelsh
Created March 2, 2011 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noelwelsh/851037 to your computer and use it in GitHub Desktop.
Save noelwelsh/851037 to your computer and use it in GitHub Desktop.
Code to set the run.mode to production within WAR files.
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Call class="java.lang.System" name="setProperty">
<Arg>run.mode</Arg>
<Arg>production</Arg>
</Call>
</Configure>
val jettyWebPath = "src" / "main" / "webapp" / "WEB-INF" / "jetty-web.xml"
lazy val installProductionRunMode = task {
FileUtilities.copyFile("project" / "jetty-web.xml",
jettyWebPath,
log)
log.info("Copied jetty-web.xml into place")
None
} describedAs("Install a jetty-web.xml that sets the run mode to production")
lazy val superPackage = super.packageAction dependsOn(installProductionRunMode)
lazy val removeProductionRunMode = task {
FileUtilities.clean(jettyWebPath, log)
None
} describedAs("Remove jetty-web.xml and hence set run mode back to testing")
override def packageAction = removeProductionRunMode dependsOn(superPackage) describedAs BasicWebScalaProject.PackageWarDescription
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment