-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
64 lines (54 loc) · 1.62 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
apply plugin: 'groovy'
apply plugin: 'java'
// set the dependencies for running the groovy script
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.codehaus.groovy:groovy-all:2.0.5'
classpath 'org.apache.knox:gateway-shell:0.8.0'
}
}
// 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.8.0'
// compile MapReduce class
compile(group: 'org.apache.hadoop', name: 'hadoop-common', version:'2.2.0') { }
compile(group: 'org.apache.hadoop', name: 'hadoop-mapreduce-client-core', version:'2.2.0') { }
}
// tell gradle the groovy script is in the same folder as the build.gradle file
sourceSets {
main {
groovy {
srcDirs = ['.']
}
// uncomment to enable http debugging
// run './gradlew clean' after commenting/uncommenting
resources {
// srcDirs = ['resources']
}
}
}
// MapReduce classes
jar {
archiveName = 'hadoop-examples.jar'
destinationDir = file('samples')
}
// 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
}