forked from tchiotludo/akhq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
249 lines (212 loc) · 8.76 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
buildscript {
ext {
micronautVersion = "1.2.7"
confluentVersion = "5.3.+"
kafkaVersion = "2.4.0"
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
// kafkahq
classpath "com.commercehub.gradle.plugin:gradle-avro-plugin:0.17.0"
}
}
plugins {
// micronaut
id "io.spring.dependency-management" version "1.0.8.RELEASE"
id "com.github.johnrengelman.shadow" version "5.2.0"
id "application"
id "java"
id "net.ltgt.apt-eclipse" version "0.21"
id "net.ltgt.apt-idea" version "0.21"
id "com.gorylenko.gradle-git-properties" version "2.2.0"
// kafkahq
id "com.moowork.node" version "1.3.1"
id 'io.franzbecker.gradle-lombok' version '3.2.0'
id 'com.adarshr.test-logger' version '2.0.0'
id 'com.github.psxpaul.execfork' version '0.1.12'
id "com.github.ben-manes.versions" version "0.27.0"
}
apply plugin: "com.commercehub.gradle.plugin.avro"
group "org.kafkahq"
version "0.1"
mainClassName = "org.kafkahq.App"
sourceCompatibility = 11
repositories {
mavenLocal()
mavenCentral()
maven { url 'http://packages.confluent.io/maven/' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://jcenter.bintray.com" }
}
lombok {
version = '1.18.10'
sha256 = ""
}
idea {
module {
downloadJavadoc = false
downloadSources = true
}
}
configurations.all {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
}
/**********************************************************************************************************************\
* Micronaut
**********************************************************************************************************************/
dependencyManagement {
imports {
mavenBom "io.micronaut:micronaut-bom:$micronautVersion"
}
}
configurations {
developmentOnly
}
run.classpath += configurations.developmentOnly
test.classpath += configurations.developmentOnly
run.jvmArgs('-noverify',
'-XX:TieredStopAtLevel=1',
'-Dmicronaut.environments=dev',
'-Dmicronaut.io.watch.restart=true'
)
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
}
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(run) || graph.hasTask(testClasses)) {
webpack.enabled = false
npmInstall.enabled = false
}
}
/**********************************************************************************************************************\
* Dependencies
**********************************************************************************************************************/
dependencies {
// micronaut
annotationProcessor "io.micronaut:micronaut-inject-java"
annotationProcessor "io.micronaut:micronaut-validation"
annotationProcessor "io.micronaut:micronaut-security"
compile "io.micronaut:micronaut-inject"
compile "io.micronaut:micronaut-validation"
compile 'io.micronaut:micronaut-views'
compile "io.micronaut:micronaut-runtime"
compile "io.micronaut:micronaut-http-client"
compile "io.micronaut:micronaut-http-server-netty"
runtime "ch.qos.logback:logback-classic:1.2.3"
runtime 'org.freemarker:freemarker:2.3.28'
compile "io.micronaut:micronaut-security"
compile "io.micronaut:micronaut-security-session"
compile "io.micronaut:micronaut-management"
compile 'io.micronaut.configuration:micronaut-micrometer-registry-prometheus'
compile "io.micronaut.configuration:micronaut-security-ldap"
compile 'io.github.mweirauch:micrometer-jvm-extras:0.2.0'
// kafka
compile group: "org.apache.kafka", name: "kafka-clients", version: kafkaVersion
compile group: "io.confluent", name: "kafka-schema-registry-client", version: confluentVersion
compile group: "io.confluent", name: "kafka-avro-serializer", version: confluentVersion
compile group: 'org.apache.avro', name: 'avro', version: '1.9.0'
compile group: 'org.sourcelab', name: 'kafka-connect-client', version: '2.1.0'
// log
compile group: 'org.slf4j', name: 'jul-to-slf4j', version: '1.8.+'
compile group: 'org.slf4j', name: 'log4j-over-slf4j', version: '1.8.+'
// utils
compileOnly group: "org.projectlombok", name: "lombok", version: "1.18.+"
compile group: 'org.codehaus.httpcache4j.uribuilder', name: 'uribuilder', version: '2.0.0'
compile group: 'com.google.guava', name: 'guava', version: '28.1-jre'
compile group: "com.google.code.gson", name: "gson", version: "2.8.+"
// micronaut test
testAnnotationProcessor "io.micronaut:micronaut-inject-java"
testCompile "org.junit.jupiter:junit-jupiter-api"
testCompile "io.micronaut.test:micronaut-test-junit5"
testRuntime "org.junit.jupiter:junit-jupiter-engine"
testCompile "org.mockito:mockito-junit-jupiter:3.2.0"
// test
testCompile "com.salesforce.kafka.test:kafka-junit5:3.2.0"
testCompile "org.apache.kafka:kafka_2.12:" + kafkaVersion
// force jackson version compatible with kafka
testCompile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.10.0'
testCompile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.10.0'
testCompile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.0'
testCompile "io.confluent:kafka-schema-registry:" + confluentVersion
testCompile "io.confluent:kafka-schema-registry:" + confluentVersion + ":tests"
testCompile "org.apache.kafka:connect-runtime:" + kafkaVersion
testCompile "org.apache.kafka:connect-file:" + kafkaVersion
testCompile group: 'org.apache.kafka', name: 'kafka-streams', version: kafkaVersion
testCompile group: "io.confluent", name: "kafka-streams-avro-serde", version: confluentVersion
testCompile "io.confluent:kafka-connect-avro-converter:" + confluentVersion
testCompile group: 'commons-codec', name: 'commons-codec', version: '1.13'
testCompile group: 'org.codehaus.jackson', name: 'jackson-mapper-lgpl', version: '1.9.3'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
}
/**********************************************************************************************************************\
* Test
**********************************************************************************************************************/
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
testlogger {
theme 'mocha'
showExceptions true
slowThreshold 2000
showStandardStreams true
}
task testKafkaCluster(type:JavaExec) {
group = 'verification'
description = 'Start a standalone test Kafka cluster'
classpath sourceSets.test.runtimeClasspath
main = "org.kafkahq.KafkaTestCluster"
}
task testInjectData(type:JavaExec) {
group = 'verification'
description = 'Inject data in a existing kafka cluster'
classpath sourceSets.test.runtimeClasspath
main = "org.kafkahq.KafkaTestCluster"
args 'inject'
}
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(test) || graph.hasTask(testKafkaCluster) || graph.hasTask(testInjectData)) {
webpack.enabled = false
npmInstall.enabled = false
}
}
test.dependsOn "startTestKafkaCluster"
task startTestKafkaCluster(type: com.github.psxpaul.task.JavaExecFork, dependsOn: 'testClasses') {
group = 'verification'
description = 'Start a global standalone test Kafka cluster during tests'
classpath = sourceSets.test.runtimeClasspath
main = 'org.kafkahq.KafkaTestCluster'
waitForOutput = 'Test data injected sleep done'
timeout = 300
}
/**********************************************************************************************************************\
* Node + Webpack
**********************************************************************************************************************/
import com.moowork.gradle.node.task.NodeTask
task webpack(type: NodeTask, dependsOn: "npmInstall") {
group = 'build'
description = 'Build with webpack assets'
script = project.file("node_modules/.bin/webpack")
outputs.dir("src/main/resources/static")
args = ["-p", "--mode production"]
}
jar.dependsOn "webpack"
processResources.dependsOn 'webpack'
clean.delete << file("src/main/resources/static")
/**********************************************************************************************************************\
* Jar
**********************************************************************************************************************/
shadowJar {
mergeServiceFiles()
}