Skip to content

Instantly share code, notes, and snippets.

@bantonsson
Last active December 14, 2015 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bantonsson/5004611 to your computer and use it in GitHub Desktop.
Save bantonsson/5004611 to your computer and use it in GitHub Desktop.
Akka sbt-plugin packaging dependencies with names set for some projects
In a new directory:
> mkdir project foo bar baz biz
Place ExampleBuild.scala and plugins.sbt in project
sbt foo/dist
ls -la foo/target/dist/lib
import sbt._
import Keys._
import akka.sbt.AkkaKernelPlugin
import akka.sbt.AkkaKernelPlugin.{ Dist, outputDirectory, distJvmOptions}
object ExampleBuild extends Build {
lazy val buildSettings = Defaults.defaultSettings ++ Seq(
organization := "example",
version := "1.0-SNAPSHOT",
scalaVersion := "2.10.0",
crossVersion := CrossVersion.full
)
lazy val example = Project(
id = "example",
base = file("."),
settings = buildSettings,
aggregate = Seq(foo, bar, baz, biz)
)
lazy val foo = Project(
id = "foo",
base = file("foo"),
dependencies = Seq(bar),
settings = buildSettings ++ AkkaKernelPlugin.distSettings ++ Seq(
name := "extra-foo",
libraryDependencies ++= Dependencies.example,
distJvmOptions in Dist := "-Xms256M -Xmx2048M",
outputDirectory in Dist <<= target / "dist"
)
)
lazy val bar = Project(
id = "bar",
base = file("bar"),
dependencies = Seq(baz),
settings = buildSettings ++ Seq(name := "extra-bar")
)
lazy val baz = Project(
id = "baz",
base = file("baz"),
dependencies = Seq(biz),
settings = buildSettings ++ Seq(name := "extra-baz")
)
lazy val biz = Project(
id = "biz",
base = file("biz"),
settings = buildSettings ++ Seq(libraryDependencies ++= Seq("com.typesafe.akka" %% "akka-remote" % "2.1.1"))
)
object Dependencies {
val example = Seq(
// ---- application dependencies ----
"com.typesafe.akka" %% "akka-actor" % "2.1.1",
"com.typesafe.akka" %% "akka-kernel" % "2.1.1"
)
}
}
addSbtPlugin("com.typesafe.akka" % "akka-sbt-plugin" % "2.1.1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment