-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
318 lines (272 loc) · 9.48 KB
/
build.gradle
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.7.RELEASE'
}
}
plugins {
id 'com.github.lkishalmi.gatling' version '0.4.1' apply false
id 'com.github.johnrengelman.shadow' version '2.0.1' apply false
id 'org.hidetake.ssh' version '2.9.0'
}
remotes {
hadoopMaster {
host = 'hadoop-1'
user = 'vagrant'
// identity = file("${System.getProperty('user.home')}/.vagrant.d/insecure_private_key")
identity = file("/Users/markus/.vagrant.d/boxes/markush81-VAGRANTSLASH-centos7-vbox-guestadditions/1.0.3/virtualbox/vagrant_private_key")
}
}
ssh {
settings {
knownHosts = allowAnyHosts
}
}
allprojects {
apply plugin: 'idea'
repositories {
mavenCentral()
maven {
url "https://repository.apache.org/content/repositories/snapshots/"
}
}
}
subprojects {
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
dependencies {
compile 'com.google.guava:guava:21.+'
// logging
compile 'org.slf4j:slf4j-api:1.7.+'
compile 'ch.qos.logback:logback-classic:1.1.+'
// testing
testCompile 'junit:junit:4.+'
testCompile 'org.hamcrest:hamcrest-library:1.+'
}
}
project(':external') {
apply plugin: 'org.springframework.boot'
apply plugin: 'scala'
apply plugin: 'com.github.lkishalmi.gatling'
dependencies {
//scala because of gatling
compile 'org.scala-lang:scala-library:2.11.+'
//application
compile project(':legacy')
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-hateoas'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.kafka:spring-kafka:1.2.1.RELEASE'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.+'
//devtools
compile 'org.springframework.boot:spring-boot-devtools'
//database
compile 'org.hibernate:hibernate-java8'
compile 'com.h2database:h2:1.4.193'
//testing
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile ('org.springframework.kafka:spring-kafka-test:1.3.0.RELEASE') {
exclude module: 'log4j'
}
testCompile 'com.jayway.jsonpath:json-path-assert:2.2.0'
testCompile 'org.exparity:hamcrest-date:2.0.4'
testCompile 'org.awaitility:awaitility:2.0.0'
testRuntime 'javax.xml.bind:jaxb-api:2.3.0'
//scala test
gatlingCompile 'org.scalatest:scalatest_2.11:3.0.4'
gatlingRuntime 'com.h2database:h2:1.4.193'
}
build.dependsOn gatlingClasses
bootRepackage {
excludeDevtools = true
}
gatling {
toolVersion = '2.2.3'
}
task h2console(type:JavaExec) {
main = 'org.h2.tools.Console'
classpath = sourceSets.main.runtimeClasspath
}
}
project(':legacy') {
dependencies {
compile 'org.springframework.boot:spring-boot-starter-data-jpa:1.5.7.RELEASE'
}
}
project(':flink') {
apply plugin: 'scala'
apply plugin: 'com.github.johnrengelman.shadow'
sourceSets {
flink
main {
compileClasspath = compileClasspath + configurations.flinkCompileClasspath
runtimeClasspath = runtimeClasspath + configurations.flinkCompileClasspath
}
}
dependencies {
//scala
compile 'org.scala-lang:scala-library:2.11.+'
//flink
compile 'org.apache.flink:flink-scala_2.11:1.4-SNAPSHOT'
compile 'org.apache.flink:flink-streaming-scala_2.11:1.4-SNAPSHOT'
compile 'org.apache.flink:flink-clients_2.11:1.4-SNAPSHOT'
flinkCompile 'org.apache.flink:flink-connector-kafka-0.11_2.11:1.4-SNAPSHOT'
}
jar.enabled false
shadowJar {
configurations = [project.configurations.flinkCompile]
classifier = null
}
tasks.addRule("Pattern: runFlink<ClassName>") { String taskName ->
def taskPrefix = "runFlink"
if (taskName.startsWith(taskPrefix)) {
task(taskName) {
doLast {
def jobName = taskName.replaceFirst(taskPrefix, "")
ssh.run {
session(remotes.hadoopMaster) {
def executable = "${project.name}-${version}.jar"
put from: "$project.buildDir/libs/$executable", into: '/vagrant/exchange'
execute "flink run -c net.fast2smart.streaming.${jobName} -d /vagrant/exchange/$executable"
}
}
}
}
}
}
tasks.addRule("Pattern: stopFlink<ClassName>") { String taskName ->
def taskPrefix = "stopFlink"
if (taskName.startsWith(taskPrefix)) {
task(taskName) {
doLast {
def jobName = taskName.replaceFirst(taskPrefix, "")
ssh.run {
session(remotes.hadoopMaster) {
execute "flink cancel `flink list | grep $jobName | awk '{split(\$0,a,\" \"); print a[4]}'`"
}
}
}
}
}
}
build.dependsOn shadowJar
}
project(':spark') {
apply plugin: 'scala'
apply plugin: 'com.github.johnrengelman.shadow'
sourceSets {
spark
main {
compileClasspath += configurations.sparkCompileClasspath
runtimeClasspath += configurations.sparkRuntimeClasspath
}
}
dependencies {
//scala
compile 'org.scala-lang:scala-library:2.11.+'
//spark
compile('org.apache.spark:spark-core_2.11:2.2.0') {
exclude module: 'slf4j-log4j12'
}
compile('org.apache.spark:spark-sql_2.11:2.2.0') {
exclude module: 'slf4j-log4j12'
}
compile('org.apache.spark:spark-streaming_2.11:2.2.0') {
exclude module: 'slf4j-log4j12'
}
sparkCompile('org.apache.spark:spark-streaming-kafka-0-10_2.11:2.2.0') {
exclude module: 'slf4j-log4j12'
}
//json
sparkCompile 'org.json4s:json4s-native_2.11:3.2.11'
sparkCompile 'org.json4s:json4s-jackson_2.11:3.2.11'
//cassandra
sparkCompile('com.datastax.spark:spark-cassandra-connector_2.11:2.0.5') {
exclude module: 'slf4j-log4j12'
}
//database
sparkCompile 'com.h2database:h2:1.4.193'
}
task aggregation(type:JavaExec) {
main = 'net.fast2smart.batch.AccountAggregation'
classpath = sourceSets.main.runtimeClasspath
}
tasks.addRule("Pattern: runSpark<ClassName>") { String taskName ->
def taskPrefix = "runSpark"
if (taskName.startsWith(taskPrefix)) {
task(taskName) {
doLast {
def jobName = taskName.replaceFirst(taskPrefix, "")
ssh.run {
session(remotes.hadoopMaster) {
def executable = "${project.name}-${version}.jar"
put from: "$project.buildDir/libs/$executable", into: '/vagrant/exchange'
execute "hdfs dfs -touchz /tmp/${jobName}.running"
execute "spark-submit --master yarn --class net.fast2smart.streaming.${jobName} --conf spark.yarn.submit.waitAppCompletion=false --deploy-mode cluster --executor-memory 1G --num-executors 3 /vagrant/exchange/$executable"
}
}
}
}
}
}
tasks.addRule("Pattern: stopSpark<ClassName>") { String taskName ->
def taskPrefix = "stopSpark"
if (taskName.startsWith(taskPrefix)) {
task(taskName) {
doLast {
def jobName = taskName.replaceFirst(taskPrefix, "")
ssh.run {
session(remotes.hadoopMaster) {
execute "hdfs dfs -rm -f /tmp/${jobName}.running"
}
}
}
}
}
}
jar.enabled false
shadowJar {
configurations = [project.configurations.sparkCompile]
classifier = null
}
build.dependsOn shadowJar
}
project(':systemtest') {
apply plugin: 'groovy'
dependencies {
//groovy
compile 'org.codehaus.groovy:groovy-all:2.4.+'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile('com.athaydes:spock-reports:1.2.+' ) {
transitive = false
}
testCompile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1'
testCompile 'com.github.zhicwu:cassandra-jdbc-driver:0.6.4'
testCompile 'com.h2database:h2:1.4.193'
}
test {
exclude '**/*Spec.class'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.2'
distributionUrl = 'https://services.gradle.org/distributions/gradle-4.2-all.zip'
}
idea {
targetVersion = '17'
}