Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- organization := "MyOrg"
- name := "MyProj"
- // artifactName in ThisBuild := {
- // (_: ScalaVersion, module: ModuleID, artifact: Artifact) =>
- // artifact.name + "-" + module.revision + "." + artifact.extension
- // }
- scalaVersion := "2.10.3"
- scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation", "-feature")
- compileOrder := CompileOrder.JavaThenScala
- libraryDependencies in ThisBuild ++= Seq(
- "org.scalatest" %% "scalatest" % "2.0" % "test",
- "com.github.nscala-time" %% "nscala-time" % "0.8.0",
- "net.liftweb" %% "lift-mongodb-record" % "2.6-M2" % "compile->default",
- "com.foursquare" %% "rogue-field" % "2.2.1" intransitive(),
- "com.foursquare" %% "rogue-core" % "2.3.0" intransitive(),
- "com.foursquare" %% "rogue-lift" % "2.3.0" intransitive(),
- "com.foursquare" %% "rogue-index" % "2.3.0" intransitive(),
- "org.scribe" % "scribe" % "1.3.5")
- EclipseKeys.skipParents := false
- lazy val common = project in file("BAGCommon")
- lazy val core = project in file("Personality.Core") dependsOn common
- // for some reason, 'analysis' clashes with something in SBT when referred to in makeDeployJar below
- lazy val analysisProj = project in file("Personality.Analysis") dependsOn (common, core)
- lazy val ui = project in file("Personality.UI") dependsOn (core, analysisProj)
- lazy val root = project in file(".") aggregate (common, core, analysisProj, ui) dependsOn (common, core, analysisProj, ui)
- // avoid 'clean' cleaning out the dependencies
- cleanKeepFiles <+= target / "streams"
- cleanKeepFiles <+= target / "resolution-cache"
- // one-jar
- seq(com.github.retronym.SbtOneJar.oneJarSettings: _*)
- exportJars := true
- mainClass in oneJar := Some("com.myorg.myproj.web.WebMain")
- lazy val makeDeployJar = taskKey[java.io.File](
- "Runs 'package', collects all the sub-project JARs in the lib folder of the root project, and runs 'one-jar'")
- makeDeployJar := {
- val jars = List(
- (Keys.`package` in Compile in root).value,
- (Keys.`package` in Compile in common).value,
- (Keys.`package` in Compile in core).value,
- (Keys.`package` in Compile in analysisProj).value,
- (Keys.`package` in Compile in ui).value
- )
- // looks like OneJar operates on JARs in the root lib only, so we need to collect all of our JARs
- // and temporarily copy them to lib and delete them later:
- val libDir = (baseDirectory in root).value / "lib"
- val libPaths = jars.map(libDir / _.getName)
- IO.copy(jars zip libPaths)
- val ret = oneJar.value
- IO.delete(libPaths)
- // move the resulting JAR to a more human friendly location
- val finalPath = (baseDirectory in root).value / "profile.jar"
- IO.copyFile(ret, finalPath)
- // this is the tedious SBT way of logging
- streams.value.log.info(finalPath.toString)
- // return the resulting JAR path for completeness' sake
- finalPath
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement