forked from jprante/elasticsearch-jdbc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
211 lines (190 loc) · 6.54 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
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '1.2.2'
}
def xbibGroup = 'org.xbib.elasticsearch.importer'
def xbibVersion = '2.2.0.1'
group = xbibGroup
version = xbibVersion
ext {
pluginName = 'elasticsearch-jdbc'
pluginClassname = 'org.xbib.elasticsearch.plugin.jdbc.JDBCPlugin'
pluginDescription = 'JDBC importer service for Elasticsearch'
versions = [
'elasticsearch' : '2.2.0',
'elasticsearch-helper' : '2.2.0.3',
'log4j': '2.5',
'wagon' : '2.10',
'jsr166e': '1.1.0',
'jna' : '4.1.0',
'spatial4j': '0.5',
'jts' : '1.13',
'jdbc-driver-csv': '1.0.0',
'junit' : '4.12',
'testng': '6.9.10',
'derby' : '10.12.1.1',
'h2' : '1.4.191',
'hsqldb' : '2.3.3',
'mysql' : '5.1.38',
'postgresql' : '9.4.1208.jre7'
]
databases = ['derby', 'h2', 'hsqldb']
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'maven-publish'
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url "http://xbib.org/repository"
}
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
resources {
srcDir file('src/integration-test/resources')
}
}
}
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
configurations {
wagon
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
driverJars
}
dependencies {
compile 'org.elasticsearch:elasticsearch:' + versions.elasticsearch
compile 'org.xbib.elasticsearch.plugin:elasticsearch-helper:' + versions.'elasticsearch-helper'
compile 'org.apache.logging.log4j:log4j-slf4j-impl:' + versions.log4j
compile 'org.apache.logging.log4j:log4j-core:'+ versions.log4j
compile('com.vividsolutions:jts:' + versions.jts) {
exclude group: 'xerces'
}
testCompile 'org.testng:testng:' + versions.testng
testCompile 'net.java.dev.jna:jna:' + versions.jna
// Workaround for a known issue with TestNG 6.x: explicitly add Guice (Gradle will fail to run tests otherwise)
testCompile 'com.google.inject:guice:3.0'
testCompile 'org.uncommons:reportng:1.1.4'
testCompile 'org.apache.logging.log4j:log4j-slf4j-impl:' + versions.log4j
testCompile 'org.apache.logging.log4j:log4j-core:'+ versions.log4j
integrationTestCompile 'org.testng:testng:' + versions.testng
integrationTestCompile 'org.elasticsearch:elasticsearch:' + versions.elasticsearch
integrationTestCompile 'net.java.dev.jna:jna:' + versions.jna
// for distribution
driverJars('org.xbib.jdbc:jdbc-driver-csv:' + versions.'jdbc-driver-csv') {
exclude group: 'org.apache.logging.log4j'
}
driverJars 'org.apache.derby:derby:' + versions.derby
driverJars 'com.h2database:h2:' + versions.h2
driverJars 'org.hsqldb:hsqldb:' + versions.hsqldb
driverJars 'mysql:mysql-connector-java:' + versions.mysql
driverJars 'org.postgresql:postgresql:' + versions.postgresql
// download from Oracle JDBC download site (needs registration)
// http://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html
// driverJars 'com.oracle:ojdbc7:12.1.0.1'
wagon 'org.apache.maven.wagon:wagon-ssh-external:' + versions.wagon
}
task integrationTest(type: Test, dependsOn: [':unpackPlugin']) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = configurations.integrationTestCompile
classpath += fileTree('plugins/' + pluginName).include('*.jar')
classpath += sourceSets.integrationTest.output
// remove identical jars from classpath, otherwise Elasticsearch will complain a "jar hell"
//classpath -= configurations.releaseJars
outputs.upToDateWhen { false }
systemProperty 'log4j.configurationFile', projectDir.absolutePath + '/src/test/resources/log4j2.xml'
systemProperty 'path.home', projectDir.absolutePath
}
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
test {
useTestNG() {
testLogging.showStandardStreams = false
suiteXmlBuilder().suite(name: 'gradle-testng-jdbc', verbose: '1') {
test(name : 'Support Tests') {
classes([:]) {
'class'(name: 'org.xbib.elasticsearch.common.util.ValuesTests')
'class'(name: 'org.xbib.elasticsearch.common.util.ValueListenerTests')
'class'(name: 'org.xbib.elasticsearch.common.util.SQLCommandTests')
}
}
}
}
options {
listeners << 'org.xbib.elasticsearch.util.TestListener'
listeners << 'org.uncommons.reportng.HTMLReporter'
listeners << 'org.uncommons.reportng.JUnitXMLReporter'
}
ext.useDefaultListeners = true
ext.workingDirectory = 'build/'
}
databases.each { database ->
apply from: rootProject.file("gradle/${database}.gradle")
}
check {
databases.each { database ->
dependsOn "${database}IntegrationTest"
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
into 'build/tmp/sources'
classifier 'sources'
}
task buildDistZip(type: Zip, dependsOn: jar) {
into(project.name + '-' + project.version + '/lib') {
from configurations.runtime.allArtifacts.files
from configurations.runtime
from configurations.driverJars
}
into(project.name + '-' + project.version + '/bin') {
from 'bin'
}
classifier = 'dist'
}
shadowJar {
baseName = project.name
version = project.version
classifier = 'all'
manifest {
attributes 'Main-Class': 'org.xbib.tools.Runner'
}
}
artifacts {
archives sourcesJar, shadowJar, buildDistZip
}
publishing {
publications {
shadow(MavenPublication) {
from components.shadow
artifactId = project.name
}
}
}
uploadArchives {
repositories {
if (project.hasProperty("xbibUsername")) {
mavenDeployer {
configuration = configurations.wagon
repository(
id: 'xbib.org',
url: uri('scpexe://xbib.org/repository'),
authentication: [userName: xbibUsername, privateKey: xbibPrivateKey]
)
}
}
}
}