/
build.sbt
36 lines (25 loc) · 1.24 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import NativePackagerKeys._
import AssemblyKeys._
name := "test-api"
version := "1.0"
libraryDependencies += "io.dropwizard" % "dropwizard-core" % "0.8.0"
libraryDependencies += "io.dropwizard" % "dropwizard-assets" % "0.8.0"
{ // Needed for Heroku's stage. Uses sbt-native-packager plugin, defined in project/plugins.sbt
val stage = TaskKey[Unit]("stage", "Prepares the project to be run, in environments that deploy source trees rather than packages.")
stage in Compile := {}
}
// Indicates which class' main() method is going to be used by default.
mainClass in Compile := Some("org.tomaszjaneczko.testpoc.api.TestAPIApplication")
// Using java_server archetype from sbt-native-packager.
packageArchetype.java_server
// Adding assemblySettings to activate sbt-assembly.
assemblySettings
// Final jar name.
jarName in assembly := "test-api.jar"
// removes all jar mappings in universal and appends the fat jar
mappings in Universal <<= (mappings in Universal, assembly in Compile) map { (mappings, fatJar) =>
val filtered = mappings filter { case (file, name) => ! name.endsWith(".jar") }
filtered :+ (fatJar -> ("lib/" + fatJar.getName))
}
// the bash scripts classpath only needs the fat jar
scriptClasspath := Seq( (jarName in assembly).value )