Created
March 19, 2017 17:12
-
-
Save martinloverse/d7a53e09c2093df7eace8650bb02b0aa to your computer and use it in GitHub Desktop.
sbt - Multi Project build.sbt sample
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
name := "scala-for-work" | |
// 共通設定 | |
lazy val commonSettings = Seq( | |
organization := "io.martin.lover", | |
version := "0.1.0", | |
scalaVersion := "2.12.1", | |
// SBT Consoleでサブプロジェクトの名前を表示 | |
shellPrompt := { s => | |
(scala.Console.GREEN + s"[${Project.extract(s).currentProject.id}] > " + scala.Console.RESET) | |
}, | |
// 共通のLibraryDependencies | |
libraryDependencies ++= Seq ( | |
"org.specs2" %% "specs2-core" % "3.8.9" % "test" | |
) | |
) | |
// ライブラリ検索レポジトリの追加 | |
resolvers += Resolver.mavenLocal | |
// サブプロジェクト毎の依存 | |
lazy val webLibraryDependencies = { | |
val akkaHttpVersion = "10.0.4" | |
Seq ( | |
"com.typesafe.akka" %% "akka-http-core" % akkaHttpVersion, | |
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion, | |
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion, | |
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % "test" | |
) | |
} | |
lazy val batchLibraryDependencies = { | |
lazy val akkaVersion = "2.4.17" | |
Seq ( | |
// Daemon | |
"commons-daemon" % "commons-daemon" % "1.0.15", | |
"com.typesafe.akka" %% "akka-actor" % akkaVersion, | |
"com.typesafe.akka" %% "akka-cluster" % akkaVersion, | |
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test" | |
) | |
} | |
// 集約 | |
lazy val `root` = (project in file(".")) | |
.aggregate(`core`, `web`, `batch`) | |
// サブプロジェクト | |
lazy val `core` = (project in file("core")) | |
.settings(commonSettings) | |
lazy val `web` = (project in file("web")) | |
.settings(commonSettings) | |
.settings(libraryDependencies ++= webLibraryDependencies) | |
.dependsOn(core) | |
lazy val `batch` = (project in file("batch")) | |
.settings(commonSettings) | |
.settings(libraryDependencies ++= batchLibraryDependencies) | |
.dependsOn(core) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment