-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
68 lines (55 loc) · 1.73 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
// set the dependencies for running the groovy script
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.hive:hive-jdbc:2.0.0'
}
}
plugins {
id 'groovy'
id 'org.hidetake.ssh' version '1.5.0'
}
// set the dependencies for compiling the groovy script
repositories {
mavenCentral()
}
dependencies {
// compile('org.apache.hive:hive-jdbc:2.0.0') {
// exclude group:'org.apache.logging.log4j', module:'log4j-slf4j-impl'
// }
compile('org.apache.hive:hive-jdbc:2.0.0')
}
sourceSets {
main {
resources {
srcDir file('.') include 'truststore.jks'
}
}
}
// load some common helper methods
apply from: "${projectDir}/../../shared/common-helpers.gradle"
// task to run a Java class
task('CreateTable', type: JavaExec) {
Properties props = new Properties()
props.load(new FileInputStream("$projectDir/../../connection.properties"))
if (!(new File("${projectDir}/../../certificate").exists())) {
throw new GradleException("'certificate' file could not be found in ${projectDir.parentFile.parentFile}")
}
delete './truststore.jks'
// import the BigInsights manager certificate
ant.exec(executable: 'keytool', dir:'./') {
arg(line: '-import -trustcacerts -alias biginsights -file ../../certificate -keystore ./truststore.jks -storepass mypassword -noprompt')
}
// pass environment variables to the class
environment 'hostname', getMasters(props)['HIVE_SERVER'][0]
environment 'username', props.username
environment 'password', props.password
// run the class
main = 'Example'
classpath = sourceSets.main.runtimeClasspath
}
task('Example') {
dependsOn CreateTable
}