Skip to content

Instantly share code, notes, and snippets.

@narcisobenigno
Created August 5, 2012 03:47
Show Gist options
  • Save narcisobenigno/3261476 to your computer and use it in GitHub Desktop.
Save narcisobenigno/3261476 to your computer and use it in GitHub Desktop.
SBT configs to use Jetty 8.1.x
import sbt._
import Keys._
import com.github.siasia._
import WebPlugin._
import WebappPlugin._
import PluginKeys._
object WebAppWithJetty extends Build {
lazy val root = Project(
"Web App with Jetty 8",
file(".")
) settings(coreSettings ++ coreWebSettings: _*)
lazy val commonSettings: Seq[Setting[_]] = Seq(
organization := "njalldev",
name := "jetty8WebApp",
version := "0.1-SNAPSHOT",
scalaVersion := "2.9.2",
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-g:vars")
)
lazy val coreWebSettings = webSettings ++ inConfig(Runtime)(webappSettings0) ++ Seq(
classpathTypes ~= (_ + "orbit"),
libraryDependencies ++= Seq(
"org.eclipse.jetty" % "jetty-server" % "8.1.4.v20120524" % "container",
"org.eclipse.jetty" % "jetty-webapp" % "8.1.4.v20120524" % "container",
"org.eclipse.jetty" % "jetty-jsp" % "8.1.4.v20120524" % "container",
orbitDep("javax.servlet", "3.0.0.v201112011016"),
orbitDep("javax.servlet.jsp", "2.2.0.v201112011158"),
orbitDep("org.apache.jasper.glassfish", "2.2.2.v201112011158"),
orbitDep("javax.servlet.jsp.jstl", "1.2.0.v201105211821"),
orbitDep("org.apache.taglibs.standard.glassfish", "1.2.0.v201112081803"),
orbitDep("javax.el", "2.2.0.v201108011116"),
orbitDep("com.sun.el", "2.2.0.v201108011116"),
orbitDep("org.eclipse.jdt.core", "3.7.1")
)
)
lazy val coreSettings: Seq[Setting[_]] = commonSettings ++ Seq(
libraryDependencies ++= Seq(
"javax.servlet" % "servlet-api" % "2.5" % "provided",
"javax.servlet.jsp" % "jsp-api" % "2.1" % "provided",
"br.com.caelum" % "vraptor" % "3.4.1" excludeAll (
ExclusionRule(organization = "org.springframework")
),
"org.specs2" %% "specs2" % "1.11"
),
classDirectory in Compile <<= webappDir {
_ / "WEB-INF" / "classes"
}
)
lazy val webappDir = baseDirectory {
_ / "src" / "main" / "webapp"
}
def orbitDep(name:String, version:String) = "org.eclipse.jetty.orbit" % name % version % "container" artifacts (Artifact(name, "jar", "jar"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment