forked from gitter-badger/waterdrop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
61 lines (52 loc) · 2.53 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name := "Waterdrop"
version := "1.5.1"
organization := "io.github.interestinglab.waterdrop"
scalaVersion := "2.11.8"
// resolved sbt assembly merging file conflicts.
assemblyMergeStrategy in assembly := {
case PathList("org", "joda", xs @ _*) => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith ".xml" => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith ".class" => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith ".thrift" => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith ".properties" => MergeStrategy.first
case PathList(ps @ _*) if ps.last endsWith ".fmpp" => MergeStrategy.first
case "UnusedStubClass.class" => MergeStrategy.last
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
dependencyOverrides += "com.google.guava" % "guava" % "15.0"
// The 'run', 'runMain' task uses all the libraries, including the ones marked with "provided".
// This is useful for running spark application in local
run in Compile <<= Defaults.runTask(fullClasspath in Compile, mainClass in (Compile, run), runner in (Compile, run))
runMain in Compile <<= Defaults.runMainTask(fullClasspath in Compile, runner in (Compile, run))
// sbt native packager
enablePlugins(JavaAppPackaging)
enablePlugins(UniversalPlugin)
// only build and include fat jar in packaging
// the assembly settings
// we specify the name for our fat jar
//assemblyJarName in assembly := name + "-" + version + "-" + scalaVersion + ".jar"
assemblyJarName in assembly := name.value + "-" + version.value + "-" + scalaVersion.value + ".jar"
// removes all jar mappings in universal and appends the fat jar
mappings in Universal := {
// universalMappings: Seq[(File,String)]
val universalMappings = (mappings in Universal).value
val fatJar = (assembly in Compile).value
// removing means filtering
val filtered = universalMappings filter {
case (file, name) => ! name.endsWith(".jar")
}
// add the fat jar
filtered :+ (fatJar -> ("lib/" + fatJar.getName))
}
// the bash scripts classpath only needs the fat jar
scriptClasspath := Seq( (assemblyJarName in assembly).value )
import NativePackagerHelper.directory
mappings in Universal += file("README.md") -> "README.md"
mappings in Universal += file("LICENSE") -> "LICENSE"
mappings in Universal ++= directory("plugins")
mappings in Universal ++= directory("docs")
mappings in Universal ++= directory("config")
mappings in Universal ++= directory("bin")