Created
March 20, 2017 17:28
-
-
Save martinloverse/e349e39d80f0f2af93fc38078c1166ee to your computer and use it in GitHub Desktop.
sbt - sbt-native-packager 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 ++= { | |
lazy val specs2Version = "3.8.9" | |
Seq ( | |
"com.typesafe" % "config" % "1.3.1", | |
"org.specs2" %% "specs2-core" % specs2Version % "test", | |
"org.specs2" %% "specs2-mock" % specs2Version % "test" | |
) | |
} | |
) | |
lazy val buildSettings = Seq ( | |
name := "scala-for-work-web", | |
version := "0.0.1_SNAPSHOT", | |
// for Linux | |
maintainer := "Martin Lover", | |
packageSummary := "martin.lover sbt-native-packager plugin sample", | |
packageDescription := "martin.lover sbt-native-packager plugin sample", | |
// for JavaServerPackaging | |
daemonUser := "worker", | |
daemonGroup := "worker", | |
// for JavaAppPackaging | |
mainClass in Compile := Some("io.lover.martin.web.Boot"), | |
// for Rpm(needed using Systemloaders) | |
// Need `brew install rpm` | |
rpmGroup := Some("Martin.lover"), | |
rpmLicense := Some("MIT"), | |
rpmVendor := "martin.lover.io" | |
) | |
// ライブラリ検索レポジトリの追加 | |
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) | |
.settings(buildSettings) | |
.enablePlugins(RpmPlugin) | |
.enablePlugins(JavaServerAppPackaging) | |
.enablePlugins(SystemVPlugin) | |
lazy val `batch` = (project in file("batch")) | |
.settings(commonSettings) | |
.settings(libraryDependencies ++= batchLibraryDependencies) | |
.dependsOn(core) | |
.enablePlugins(UniversalPlugin) | |
.enablePlugins(JavaAppPackaging) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment