forked from ppine7/kafka-elasticsearch-consumer
-
Notifications
You must be signed in to change notification settings - Fork 56
/
build.gradle
160 lines (143 loc) · 5.85 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
buildscript {
repositories { jcenter() }
dependencies {
classpath 'se.transmode.gradle:gradle-docker:1.2'
}
}
plugins {
id "com.jfrog.bintray" version "1.3.1"
id "com.jfrog.artifactory" version "4.0.0"
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'application'
apply plugin: 'docker'
group = 'org.elasticsearch.kafka.indexer'
version = release + '.' + build
mainClassName = "org.elasticsearch.kafka.indexer.KafkaESIndexerProcess"
description = "kafka-es-consumer"
def artifact_provider_url = hasProperty('artifact_provider_url') ? artifact_provider_url : System.getenv('artifact_provider_url')
def artifact_provider_user = hasProperty('artifact_provider_user') ? artifact_provider_user : System.getenv('artifact_provider_user')
def artifact_provider_org = hasProperty('artifact_provider_org') ? artifact_provider_org : System.getenv('artifact_provider_org')
def artifact_provider_secret = hasProperty('artifact_provider_secret') ? artifact_provider_secret : System.getenv('artifact_provider_secret')
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
ext {
spring_version = '4.3.8.RELEASE'
slf4j_version = '1.7.25'
logback_version = '1.2.3'
kafka_version = '2.1.1'
elasticsearch_version = '6.6.0'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.name == 'log4j') {
// https://mvnrepository.com/artifact/org.slf4j/log4j-over-slf4j
details.useTarget "org.slf4j:log4j-over-slf4j:$slf4j_version"
}
if (details.requested.name == 'commons-logging') {
// https://mvnrepository.com/artifact/org.slf4j/jcl-over-slf4j
details.useTarget "org.slf4j:jcl-over-slf4j:$slf4j_version"
}
}
}
dependencies {
// https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch
compile group: 'org.elasticsearch', name: 'elasticsearch', version: elasticsearch_version
// https://mvnrepository.com/artifact/org.elasticsearch.client/transport
compile group: 'org.elasticsearch.client', name: 'transport', version: elasticsearch_version
// https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients
compile group: 'org.apache.kafka', name: 'kafka-clients', version: kafka_version
// https://mvnrepository.com/artifact/com.google.guava/guava
compile group: 'com.google.guava', name: 'guava', version: '19.0'
// https://mvnrepository.com/artifact/org.springframework/
compile group: 'org.springframework', name: 'spring-core', version: spring_version
compile group: 'org.springframework', name: 'spring-context', version: spring_version
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
compile group: 'org.slf4j', name: 'slf4j-api', version: slf4j_version
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-to-slf4j
compile group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.8.2'
// https://mvnrepository.com/artifact/ch.qos.logback/logback-core
compile group: 'ch.qos.logback', name: 'logback-core', version: logback_version
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
compile group: 'ch.qos.logback', name: 'logback-classic', version: logback_version
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
testCompile group: 'org.springframework', name: 'spring-test', version: spring_version
}
processResources {
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [version: project.version])
}
jar {
exclude ("config")
manifest {
attributes(
"Implementation-Title": rootProject.name,
"Implementation-Version": version,
"Build-Time": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
)
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
groupId 'org.elasticsearch.kafka.indexer'
artifactId 'kafka-elasticsearch-consumer'
version project.version
}
}
}
bintray {
//dryRun = true
user = artifact_provider_user
key = artifact_provider_secret
publications = ['MyPublication']
publish = true
pkg {
repo = 'bigdatadevs-repo'
name = 'org.elasticsearch.kafka.indexer:kafka-elasticsearch-consumer'
userOrg = artifact_provider_org
licenses = ['Apache-2.0']
vcsUrl = artifact_provider_url
version {
name = project.version
desc = 'Current version'
released = new Date()
vcsTag = '0.0.2'
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
}
}
configurations = ['archives']
}
run {
// support passing -Dsystem.property=value to bootRun task
systemProperties = System.properties
}
docker {
baseImage = 'java:8'
}
task createDockerContainer(type: Docker, dependsOn: distTar) {
//project.group = 'bigdatadevs'
applicationName = project.name
addFile (tasks.distTar.archivePath, "/opt/")
addFile ("src/test/resources","/opt/conf/")
setEnvironment("JAVA_OPTS", "-Dindexer.properties=/opt/conf/kafka-es-indexer-docker.properties -Dlogback.configurationFile=/opt/conf/logback.xml");
entryPoint(["/opt/${tasks.distTar.baseName}-${tasks.distTar.version}/bin/${tasks.distTar.baseName}"])
}