Skip to content

Instantly share code, notes, and snippets.

@ppurang
Created August 22, 2011 17:19
Show Gist options
  • Save ppurang/1162946 to your computer and use it in GitHub Desktop.
Save ppurang/1162946 to your computer and use it in GitHub Desktop.
scala sbt 10 multi module project
//contents of plugins/build.sbt
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
//Following means libraryDependencies += "com.github.siasia" %% "xsbt-web-plugin" % "0.1.1-<sbt version>""
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % ("0.1.0-"+v))
import sbt._
import Keys._
import sbt.Package._
import java.util.jar.Attributes.Name._
import com.github.siasia.WebPlugin._
//unashamed copy of scalaz's build
object SlogBuild extends Build {
override lazy val settings = super.settings :+
(shellPrompt := { s => Project.extract(s).currentProject.id + "> " })
lazy val standardSettings = Defaults.defaultSettings ++ Seq(
organization := "org.purang.slog",
version := "0.3.6",
scalaVersion := "2.9.0-1",
libraryDependencies ++= Seq("org.scalatest" %% "scalatest" % "1.6.1" % "test" withSources()),
resolvers += ScalaToolsSnapshots,
//publishSetting,
//credentialsSetting,
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked"),
javacOptions ++= Seq("-Xlint:unchecked")
)
lazy val slog = Project(
id = "slog",
base = file("."),
settings = standardSettings,
aggregate = Seq(domain, client, server)
) dependsOn(domain, client)
lazy val domain = Project(
id = "slog-domain",
base = file("domain"),
settings = standardSettings ++ Seq(
libraryDependencies ++= Seq(LiftJsonDependencies.liftJson)
)
)
lazy val client = Project(
id = "slog-client",
base = file("client"),
settings = standardSettings ++ Seq (
libraryDependencies ++= Seq(LiftJsonDependencies.liftJson, JerseyDependencies.jerseyCore, JerseyDependencies.jerseyClient)
)
) dependsOn(domain)
lazy val server = Project(
id = "slog-server",
base = file("server"),
settings = standardSettings ++ webSettings ++ Seq(
libraryDependencies ++= Seq(RiaksDependencies.riaks, LiftJsonDependencies.liftJsonScalaz) ++ ScalatraDependencies.deps ++ jettyDependencies
) ++ Seq(resolvers ++= Seq(ScalatraDependencies.sonatypeNexusSnapshots))// TODO ++ Seq(deployTask(deployDirectory))
) dependsOn(domain)
object RiaksDependencies {
lazy val riaks = "org.purang.storage" % "riaks_2.9.0" % "0.3.1" //withSources()
}
object LiftJsonDependencies {
lazy val liftJson = "net.liftweb" %% "lift-json" % "2.4-M3"
lazy val liftJsonScalaz = "net.liftweb" %% "lift-json-scalaz" % "2.4-M3"
}
object JerseyDependencies {
lazy val jerseyVersion = "1.6"
lazy val jerseyCore= "com.sun.jersey" % "jersey-core" % jerseyVersion
lazy val jerseyClient= "com.sun.jersey" % "jersey-client" % jerseyVersion
}
object ScalatraDependencies {
lazy val deps = Seq(scalatra, scalate, scalateJruby, scalamd, scalatrascalatest, slf4jBinding)
lazy val scalatraVersion = "2.0.0-SNAPSHOT"
lazy val scalatra = "org.scalatra" %% "scalatra" % scalatraVersion
lazy val scalate = "org.scalatra" %% "scalatra-scalate" % scalatraVersion
lazy val scalateJruby = "org.fusesource.scalate" % "scalate-jruby" % "1.5.1"
lazy val scalamd = "org.fusesource.scalamd" % "scalamd" % "1.5"
//lazy val servletApi = "org.mortbay.jetty" % "servlet-api" % "2.5-20081211" % "provided"
// Alternatively, you could use scalatra-specs
lazy val scalatrascalatest = "org.scalatra" %% "scalatra-scalatest" % scalatraVersion % "test"
// Pick your favorite slf4j binding
lazy val slf4jBinding = "ch.qos.logback" % "logback-classic" % "0.9.29" % "runtime"
lazy val sonatypeNexusSnapshots = "Sonatype Nexus Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots"
// For Scalate
lazy val fuseSourceSnapshots = "FuseSource Snapshot Repository" at "http://repo.fusesource.com/nexus/content/repositories/snapshots"
}
lazy val jettyDependencies = Seq("javax.servlet" % "servlet-api" % "2.5" % "provided", "org.eclipse.jetty" % "jetty-webapp" % "7.3.0.v20110203" % "jetty")
}
@ppurang
Copy link
Author

ppurang commented Aug 22, 2011

Would be great if I could deploy to an external jetty/tomcat using a custom deploy task. A google search didn't bring up any candidates, so when time permits write it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment