-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
164 lines (138 loc) · 6.25 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import sbt._
import sbt.Keys._
import sbtassembly.MergeStrategy
libraryDependencies += "org.apache.spark" %% "spark-core" % "2.2.1" % "provided"
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeScala = false)
lazy val compileOptions = Seq(
"-unchecked",
"-deprecation",
"-language:_",
"-target:jvm-1.8",
"-encoding", "UTF-8",
"-Xcheckinit"
)
lazy val commonDependencies = Seq(
"org.scalatest" %% "scalatest" % "3.0.1" % "test"
)
lazy val twitterDependencies = Seq(
"org.twitter4j" % "twitter4j-core" % "3.0.3",
"org.twitter4j" % "twitter4j-stream" % "3.0.3"
)
lazy val akkaDependencies = Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4.19",
"com.typesafe.akka" %% "akka-slf4j" % "2.4.19",
"com.typesafe.akka" %% "akka-stream" % "2.4.19",
"com.typesafe.akka" %% "akka-stream-kafka" % "0.16",
"com.typesafe.akka" %% "akka-http" % "10.1.0-RC1",
"com.typesafe.akka" %% "akka-http-spray-json" % "10.1.0-RC1",
"io.spray" %% "spray-can" % "1.3.4",
"io.spray" %% "spray-client" % "1.3.4",
"io.spray" %% "spray-routing" % "1.3.4",
"io.spray" %% "spray-json" % "1.3.4",
"org.json4s" %% "json4s-jackson" % "3.2.11",
"com.fasterxml.jackson.module" % "jackson-module-scala_2.11" % "2.6.1"
)
lazy val kafkaDependencies = Seq(
"org.apache.kafka" %% "kafka" % "0.11.0.1"
)
lazy val sparkDependencies = Seq(
"org.apache.spark" %% "spark-core" % "2.2.0",
"org.apache.spark" %% "spark-streaming" % "2.2.0",
"org.apache.spark" %% "spark-streaming-kafka-0-10" % "2.2.0",
"com.datastax.spark" %% "spark-cassandra-connector" % "2.0.1",
"org.apache.spark" %% "spark-sql" % "2.2.0"
)
lazy val coreNlpDependencies = Seq(
"edu.stanford.nlp" % "stanford-corenlp" % "3.6.0",
"edu.stanford.nlp" % "stanford-corenlp" % "3.6.0" classifier "models"
)
lazy val logDependencies = Seq(
"org.slf4j" % "slf4j-api" % "1.7.18"
)
lazy val commonSettings = Seq(
organization := "ch.presland.data",
scalacOptions ++= compileOptions,
libraryDependencies ++= commonDependencies,
libraryDependencies ++= logDependencies,
licenses := Seq("Apache-2.0" -> url("https://opensource.org/licenses/Apache-2.0"))
)
lazy val root = (project in file(".")).
settings(commonSettings: _*).
settings(
name := "tweetstream",
scalaVersion := "2.11.8"
).
aggregate(commons, ingest)
lazy val commons = (project in file("commons")).
settings(commonSettings: _*).
settings(
name := "commons",
scalaVersion := "2.11.8",
libraryDependencies ++= kafkaDependencies
)
lazy val ingest = (project in file("ingestion")).
settings(commonSettings: _*).
settings(
name := "ingestion",
scalaVersion := "2.11.8",
libraryDependencies ++= akkaDependencies,
libraryDependencies ++= kafkaDependencies,
libraryDependencies ++= twitterDependencies,
mainClass in (Compile, run) := Some("ch.presland.data.stream.IngestionApp")
).dependsOn(commons)
lazy val digest = (project in file("digestion")).
settings(commonSettings: _*).
settings(
name := "digestion",
scalaVersion := "2.11.8",
libraryDependencies ++= akkaDependencies,
libraryDependencies ++= kafkaDependencies,
libraryDependencies ++= sparkDependencies,
libraryDependencies ++= twitterDependencies,
libraryDependencies ++= coreNlpDependencies,
mainClass in (Compile,run) := Some("ch.presland.data.stream.DigestionApp"),
assemblyMergeStrategy in assembly := {
case PathList("de", xs @_ * ) => MergeStrategy.first
case PathList("com", "datastax", "driver", xs @_ *) => MergeStrategy.first
case PathList("org", "apache", "flink", "streaming", "connectors", xs @_ *) => MergeStrategy.first
case PathList("org", "apache", "flink", "streaming", "util", xs @_ *) => MergeStrategy.first
case PathList("org", "apache", "kafka", "common", xs @_ *) => MergeStrategy.first
case PathList("org", "nustaq", xs @_ *) => MergeStrategy.first
case PathList("org", "apache", "flink", "batch", "connectors", "cassandra", xs @_ *) => MergeStrategy.first
case PathList("org", "apache", "flink", "batch", "connectors", "cassandra", xs @_ *) => MergeStrategy.first
case PathList("org", "apache", "flink", "cassandra", "shaded", xs @_ *) => MergeStrategy.first
case PathList("org", "apache", "kafka", "clients", xs @_ *) => MergeStrategy.first
case PathList("com", "codahale", "metrics", xs @_ *) => MergeStrategy.first
case PathList("org", "joda", xs @_ *) => MergeStrategy.first
case PathList("breeze", "linalg", xs @_ * ) => MergeStrategy.first
case PathList(xs @_ * ) => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
},
artifact in (Compile, assembly) := {
val art = (artifact in (Compile, assembly)).value
art.withClassifier(Some("assembly"))
},
addArtifact(artifact in (Compile, assembly), assembly)
).dependsOn(commons)
val srvProject = "server"
lazy val server = (project in file(srvProject)).
settings(commonSettings: _*).
settings(
name := srvProject,
scalaVersion := "2.11.8",
libraryDependencies ++= akkaDependencies,
libraryDependencies ++= sparkDependencies,
mainClass in (Compile,run) := Some("ch.presland.data.server.ServiceApp"),
artifact in (Compile, assembly) := {
val art = (artifact in (Compile, assembly)).value
art.withClassifier(Some("assembly"))
},
addArtifact(artifact in (Compile, assembly), assembly)
).dependsOn(commons)
addCommandAlias("createDigest", "digest/assembly")
addCommandAlias("submitDigest", "digest/sparkSubmit --master local[2] --class ch.presland.data.stream.DigestionApp -- localhost:9042")
addCommandAlias("ingest", "ingest/run")
addCommandAlias("digest", "digest/run")
addCommandAlias("server", "server/run")