forked from mbogoevici/elasticsearch-sink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
220 lines (171 loc) · 6.68 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
description = 'Poptalk analytics'
buildscript {
repositories {
maven { url 'http://repo.spring.io/plugins-release' }
maven { url "http://repo.spring.io/libs-snapshot" }
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.6'
classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.2.4'
classpath 'me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1'
}
}
group = 'com.infinityquick.poptalk'
ext {
moduleType = 'sink'
moduleName = 'elasticsearch'
}
repositories {
maven { url "http://repo.spring.io/plugins-release" }
mavenCentral()
}
apply plugin: "java"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'javadocHotfix'
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial"]
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial", "-Xlint:deprecation"]
// https://discuss.gradle.org/t/making-gradle-find-a-jar-in-a-flatdir-repo-when-it-is-missing-from-a-maven-repo/7587
configurations.all {
exclude group: 'com.sun.jdmk', module: 'jmxtools'
exclude group: 'com.sun.jmx', module: 'jmxri'
}
configurations {
// for handling Spring XD dependencies
dirt {}
// for handling ElasticSearch dependencies
// Note: due to a classloader issue in ElasticSearch, the library (and therefore clients) cannot be
// loaded in the module classloader and must be loaded in the parent (see the deployElasticSearch task
// below)
elasticsearch {}
provided
}
// Common dependencies
dependencies {
// Provided dependencies (for testing and IDE support)
compile "org.springframework:spring-core:$springVersion"
compile "org.springframework:spring-messaging:$springVersion"
compile "org.springframework.xd:spring-xd-module-spi:$springXDVersion"
compile "org.springframework.xd:spring-xd-tuple:$springXDVersion"
compile "org.hibernate:hibernate-validator:$hibernateValidatorVersion"
compile "org.codehaus.groovy:groovy-all:$groovyVersion"
compile "com.jayway.jsonpath:json-path:$jsonPathVersion"
compile ("org.springframework.integration:spring-integration-http:$springIntegrationVersion")
compile ("org.springframework.data:spring-data-elasticsearch:$springDataElasticSearchVersion")
compile ("org.elasticsearch:elasticsearch:$elasticSearchVersion")
dirt "org.springframework.xd:spring-xd-dirt:$springXDVersion"
// informative - for deploying elasticsearch into Spring XD and excluding references
elasticsearch "org.elasticsearch:elasticsearch:$elasticSearchVersion"
// Testing
testCompile "junit:junit:$junitVersion"
testCompile "org.springframework:spring-test:$springVersion"
testCompile "org.mockito:mockito-core:$mockitoVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
provided "org.springframework.integration:spring-integration-kafka:$kafkaVersion"
}
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceSets {
test {
resources {
srcDir "modules/${moduleType}/${moduleName}"
srcDir 'src/main/resources'
}
}
main { compileClasspath += configurations.provided }
}
javadoc {
ext.srcDir = file("${projectDir}/docs/src/api")
destinationDir = file("${buildDir}/api")
ext.tmpDir = file("${buildDir}/api-work")
configure(options) {
stylesheetFile = file("${srcDir}/spring-javadoc.css")
overview = "${srcDir}/overview.html"
docFilesSubDirs = true
outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
breakIterator = true
showFromProtected()
links = [
"http://static.springframework.org/spring/docs/3.1.x/javadoc-api",
"http://download.oracle.com/javase/6/docs/api",
]
exclude "org/springframework/data/redis/config/**"
}
title = "${rootProject.description} ${version} API"
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task xdModule(type: Copy, dependsOn: build) {
def moduleRuntime = configurations.runtime.minus(configurations.dirt).minus(configurations.elasticsearch)
def moduleDir = project.file("${buildDir}/modules/${moduleType}/${moduleName}")
inputs.property('deps', moduleRuntime)
outputs.dir "${moduleDir}/lib"
into moduleDir
from(moduleRuntime) {
into "lib"
exclude "jackson*.jar", "jcl*.jar", "joda*.jar", "slf4j*.jar", "spring-jdbc*.jar", "spring-web*.jar"
}
from(jar) {
into "lib"
}
from ("modules/${moduleType}/${moduleName}/config") {
into "config"
}
}
task xdModuleZip(type: Zip, dependsOn: xdModule) {
group = 'Distribution'
classifier = 'xdmodule'
description = "Builds -${classifier} archive, containing an XD module"
into("${moduleType}/${moduleName}") {
from(xdModule.destinationDir)
}
}
task elasticSearchDeploy(type: Copy) {
}
task xdModuleUndeploy(type:Delete) {
}
task xdModuleDeploy(type:Copy, dependsOn:xdModuleUndeploy) {
}
xdModuleDeploy.dependsOn xdModuleUndeploy
xdModuleDeploy.dependsOn xdModule
tasks.withType(Test) {
systemProperty 'runLongTests', System.getProperty('runLongTests')
testLogging {
exceptionFormat = 'full'
}
}
artifacts {
archives sourcesJar
archives javadocJar
archives xdModuleZip
}
task wrapper(type: Wrapper) {
description = 'Generates gradlew[.bat] scripts'
gradleVersion = '1.11'
}
gradle.taskGraph.whenReady {
// since we check for a Spring XD location only when deploying and undeploying, we will wait until
// the task graph is built and check whether any of those tasks are actually executing
if (gradle.taskGraph.hasTask(':elasticSearchDeploy') ||
gradle.taskGraph.hasTask(':xdModuleDeploy') ||
gradle.taskGraph.hasTask(':xdModuleUndeploy')) {
def xdHome = project.hasProperty('xdHome') ? project.xdHome : System.env.XD_HOME;
if (xdHome == null) {
throw new GradleScriptException("A Spring XD home directory must be specified, either as the environment " +
"variable XD_HOME, or through a project setting -PxdHome=<some-directory>", null)
}
elasticSearchDeploy.from(configurations.elasticsearch)
elasticSearchDeploy.into(xdHome + "/lib")
xdModuleUndeploy.delete("$xdHome/modules/$moduleType/$moduleName")
xdModuleDeploy.from(project.file("${buildDir}/modules/${moduleType}/${moduleName}"))
xdModuleDeploy.into("$xdHome/modules/$moduleType/${moduleName}")
}
}
assemble.dependsOn = ['jar', 'sourcesJar']
defaultTasks 'build'