Created
December 9, 2013 08:17
-
-
Save rajeevprasanna/7868988 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Keys._ | |
import sbtassembly.Plugin._ | |
import AssemblyKeys._ | |
import org.scalatra.sbt._ | |
import org.scalatra.sbt.PluginKeys._ | |
import com.mojolly.scalate.ScalatePlugin._ | |
import ScalateKeys._ | |
object CommandBuild extends Build { | |
val Organization = "com.example" | |
val Name = "Scalatra Command Example" | |
val Version = "0.1.0-SNAPSHOT" | |
val ScalaVersion = "2.10.2" | |
val ScalatraVersion = "2.2.0" | |
val mandubianRepo = Seq( | |
"Mandubian repository snapshots" at "https://github.com/mandubian/mandubian-mvn/raw/master/snapshots/", | |
"Mandubian repository releases" at "https://github.com/mandubian/mandubian-mvn/raw/master/releases/" | |
) | |
val buildSettings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++ scalateSettings ++ assemblySettings ++ | |
net.virtualvoid.sbt.graph.Plugin.graphSettings ++ Seq( | |
mergeStrategy in assembly <<= (mergeStrategy in assembly) { | |
(old) => { | |
case "about.html" => MergeStrategy.concat | |
case "logback.xml" => MergeStrategy.first //case PathList("logback.xml") => MergeStrategy.discard | |
case x => old(x) | |
} | |
}, | |
// copy web resources to /webapp folder | |
resourceGenerators in Compile <+= (resourceManaged, baseDirectory) map { | |
(managedBase, base) => | |
val webappBase = base / "src" / "main" / "webapp" | |
for { | |
(from, to) <- webappBase ** "*" x rebase(webappBase, managedBase / "main" / "webapp") | |
} yield { | |
Sync.copy(from, to) | |
to | |
} | |
} | |
) ++ Seq( | |
organization := Organization, | |
version := Version, | |
scalaVersion := ScalaVersion, | |
resolvers += "Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/", | |
resolvers += "snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", | |
resolvers += "releases" at "https://oss.sonatype.org/content/groups/scala-tools", | |
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/", | |
resolvers += "Spray Repository" at "http://repo.spray.io", | |
resolvers += "spray-nightlies" at "http://nightlies.spray.io", | |
resolvers += Resolver.url("sbt-plugin-releases-scalasbt", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/")), | |
resolvers ++= mandubianRepo, | |
libraryDependencies ++= Seq( | |
"org.json4s" %% "json4s-jackson" % "3.1.0", | |
"org.json4s" %% "json4s-native" % "3.2.2", | |
"net.liftweb" %% "lift-json" % "2.5.1", | |
"org.scalatra" %% "scalatra-commands" % ScalatraVersion, | |
"org.scalatra" %% "scalatra" % ScalatraVersion, | |
"org.scalatra" %% "scalatra-scalate" % ScalatraVersion, | |
"org.scala-lang" % "scala-reflect" % ScalaVersion, | |
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test", | |
"ch.qos.logback" % "logback-classic" % "1.0.6" % "runtime", | |
"com.github.tmingos" % "casbah_2.10" % "2.5.0-SNAPSHOT", | |
"org.eclipse.jetty" % "jetty-webapp" % "8.1.8.v20121106" % "container;compile", | |
"com.typesafe.akka" %% "akka-actor" % "2.2.3", | |
"com.typesafe.akka" %% "akka-remote" % "2.2.3", | |
"com.typesafe.slick" %% "slick" % "1.0.1", | |
"postgresql" % "postgresql" % "9.1-901.jdbc4", | |
"c3p0" % "c3p0" % "0.9.1.2", | |
"com.h2database" % "h2" % "1.3.173", | |
"ch.qos.logback" % "logback-classic" % "1.0.13", | |
"ch.qos.logback" % "logback-access" % "1.0.13", | |
"org.slf4j" % "slf4j-api" % "1.7.5", | |
"javax.mail" % "mail" % "1.4.7", | |
"joda-time" % "joda-time" % "2.3", | |
"jline" % "jline" % "2.11", | |
"org.apache.tika" % "tika-parsers" % "1.4" exclude("xml-apis", "xml-apis") exclude("org.apache.xmlbeans", "xmlbeans"), | |
"com.amazonaws" % "aws-java-sdk" % "1.6.4", | |
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar"))), | |
scalateTemplateConfig in Compile <<= (sourceDirectory in Compile) { | |
base => | |
Seq( | |
TemplateConfig( | |
base / "webapp" / "WEB-INF" / "templates", | |
Seq.empty, /* default imports should be added here */ | |
Seq.empty, /* add extra bindings here */ | |
Some("templates"))) | |
}) | |
lazy val rootSettings = buildSettings ++ Seq( | |
name := "nstarRoot" | |
) | |
lazy val librarySettings = buildSettings ++ Seq( | |
name := "nstar-library" | |
) | |
lazy val appSettings = buildSettings ++ | |
sbtassembly.Plugin.assemblySettings ++ Seq( | |
name := "nstar-app" | |
) | |
//lazy val project = Project("root", file("."), settings = buildSettings) | |
//Refer : https://github.com/eed3si9n/sbt-assembly-full-config-sample/blob/master/project/builds.scala | |
lazy val root = Project("root", file("."), settings = rootSettings) aggregate (app) | |
lazy val library = Project("library", file("library"), settings = librarySettings) | |
lazy val app = Project("app", file("app"), settings = appSettings) dependsOn (library) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment