Skip to content

Instantly share code, notes, and snippets.

@yamingd
Created September 4, 2014 08:50
Show Gist options
  • Save yamingd/2ccb679f2a2ae3ff7e8a to your computer and use it in GitHub Desktop.
Save yamingd/2ccb679f2a2ae3ff7e8a to your computer and use it in GitHub Desktop.
Example sbt build file for multi-module project
import sbt._
import Keys._
import sbtassembly.Plugin._
import AssemblyKeys._
import sbt.Package.ManifestAttributes
import sbt.Logger
import com.typesafe.sbt.SbtAtmos.{Atmos, atmosSettings, AtmosKeys}
object HelloSbtBuild extends Build {
//
// Project Definitions
//
// // The root project that aggregates everything else
lazy val rootprj = Project(
id = "rootprj",
base = file(".")
).settings(net.virtualvoid.sbt.graph.Plugin.graphSettings: _*) aggregate(module1, module2)
lazy val module1 = Project(
id = "module1",
base = file("module1"),
settings = baseSettings ++ Seq(
libraryDependencies ++= module1Dependencies
)
).settings(net.virtualvoid.sbt.graph.Plugin.graphSettings: _*)
lazy val module2 = Project(
id = "module2",
base = file("module2"),
settings = baseSettings ++ Seq(
libraryDependencies ++= module2Dependencies
)
).settings(net.virtualvoid.sbt.graph.Plugin.graphSettings: _*)
val module1Dependencies = Seq(
"org.twitter4j" % "twitter4j-core" % "3.0.3" intransitive(),
"org.twitter4j" % "twitter4j-stream" % "3.0.3" intransitive(),
"org.twitter4j" % "twitter4j-async" % "3.0.3" intransitive()
)
val module2Dependencies = Seq(
// Facebook
"com.restfb" % "restfb" % "1.6.9"
)
lazy val baseSettings = Defaults.defaultSettings ++ assemblySettings ++ Seq(
conflictWarning := ConflictWarning.disable,
resolvers := commonResolvers,
retrieveManaged := true
)
val commonResolvers = Seq(
"Cloudera Maven Repo" at "https://repository.cloudera.com/artifactory/cloudera-repos/",
"sbt-idea-repo" at "http://mpeltonen.github.com/maven/",
"ScalaNLP Maven2" at "http://repo.scalanlp.org/repo/",
"repo.novus snaps" at "http://repo.novus.com/snapshots/",
"repo.codahale.com" at "http://repo.codahale.com",
"Sonatype OSS Releases" at "http://oss.sonatype.org/content/repositories/releases/",
"Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/",
"Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/",
"spray repo" at "http://repo.spray.cc",
"Akka Repo" at "http://repo.akka.io/releases",
"clojars" at "http://clojars.org/repo/",
"clojure-releases" at "http://build.clojure.org/releases",
"twitter repo" at "http://maven.twttr.com"
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment