-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
61 lines (51 loc) · 1.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
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'eclipse'
// need to include spark libs in jar
apply plugin: 'com.github.johnrengelman.shadow'
// set the dependencies for running the groovy script
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.codehaus.groovy:groovy-all:2.0.5'
classpath 'org.apache.knox:gateway-shell:0.6.0'
// uberjar
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'
}
}
// set the dependencies for compiling the groovy script and mapreduce classes
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.0.5'
compile 'org.apache.knox:gateway-shell:0.6.0'
// compile Spark class
compile 'org.apache.spark:spark-core_2.10:1.4.1'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
// tell gradle the groovy script is in the same folder as the build.gradle file
sourceSets {
main {
groovy {
srcDirs = ['.']
}
}
}
// task to run the groovy script
task('OozieMapReduce', dependsOn:'jar', type: JavaExec) {
Properties props = new Properties()
props.load(new FileInputStream("$projectDir/../../connection.properties"))
environment 'gateway', props.gateway
environment 'username', props.username
environment 'password', props.password
main = 'Example'
classpath = sourceSets.main.runtimeClasspath
}
task('Example') {
dependsOn OozieMapReduce
}