Skip to content

Commit da71ae9

Browse files
authored
Merge pull request #62 from marklogic-community/feature/bump-dependencies
Bumping dependencies and using shadowJar
2 parents 19e663b + 4b9c5a1 commit da71ae9

File tree

5 files changed

+122
-122
lines changed

5 files changed

+122
-122
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ This is a connector for subscribing to Kafka queues and pushing messages to Mark
1717
1. Copy the jar to the <kafkaHome>/libs on the remote server.
1818
1. Copy the two properties (config/marklogic-connect-distributed.properties config/marklogic-sink.properties) to <kafkaHome>/config on the remote server.
1919

20-
See https://kafka.apache.org/quickstart for instructions on starting up Zookeeper and Kafka.
20+
See https://kafka.apache.org/quickstart for instructions on starting up Zookeeper and Kafka, which as of August 2022
21+
will instruct you to run the following commands (in separate terminal windows, both from the Kafka home directory):
22+
23+
bin/zookeeper-server-start.sh config/zookeeper.properties
24+
25+
and:
26+
27+
bin/kafka-server-start.sh config/server.properties
2128

2229
To start the Kafka connector in standalone mode (from the Kafka home directory):
2330

build.gradle

Lines changed: 97 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,157 +1,160 @@
11
plugins {
2-
id 'java'
3-
id 'net.saliman.properties' version '1.4.6'
4-
id "com.github.jk1.dependency-license-report" version "1.3"
2+
id 'java'
3+
id 'net.saliman.properties' version '1.5.2'
4+
id 'com.github.johnrengelman.shadow' version '7.1.2'
5+
id "com.github.jk1.dependency-license-report" version "1.3"
56
}
67

7-
sourceCompatibility = 1.8
8+
java {
9+
sourceCompatibility = 1.8
10+
targetCompatibility = 1.8
11+
}
812

913
repositories {
10-
mavenCentral()
11-
jcenter()
14+
mavenCentral()
1215
}
1316

1417
configurations {
15-
documentation
16-
assets
18+
documentation
19+
assets
20+
}
21+
22+
ext {
23+
kafkaVersion = "2.8.1"
1724
}
1825

1926
dependencies {
20-
compileOnly "org.apache.kafka:connect-api:2.5.0"
21-
compileOnly "org.apache.kafka:connect-json:2.5.0"
27+
compileOnly "org.apache.kafka:connect-api:${kafkaVersion}"
28+
compileOnly "org.apache.kafka:connect-json:${kafkaVersion}"
2229

23-
compile "com.marklogic:marklogic-client-api:5.3.0"
24-
compile ("com.marklogic:marklogic-data-hub:5.2.4") {
25-
// Prefer the version above
26-
exclude module: "marklogic-client-api"
27-
// Excluding these because there's no need for them
28-
exclude module: "spring-boot-autoconfigure"
29-
exclude module: "spring-integration-http"
30-
exclude module: "jaeger-core"
31-
exclude module: "jaeger-thrift"
30+
implementation "com.marklogic:marklogic-client-api:5.5.3"
3231

33-
// Excluding because it causes Kafka Connect to complain mightily if included
34-
exclude module: "logback-classic"
35-
}
32+
implementation("com.marklogic:marklogic-data-hub:5.7.2") {
33+
// Excluding these because there's no need for them
34+
exclude module: "spring-boot-autoconfigure"
35+
exclude module: "spring-integration-http"
36+
exclude module: "jaeger-core"
37+
exclude module: "jaeger-thrift"
3638

37-
testCompile "org.junit.jupiter:junit-jupiter-api:5.3.0"
38-
testCompile "org.apache.kafka:connect-api:2.5.0"
39-
testCompile "org.apache.kafka:connect-json:2.5.0"
40-
testCompile "com.google.code.gson:gson:2.8.6"
39+
// Excluding because it causes Kafka Connect to complain mightily if included
40+
exclude module: "logback-classic"
41+
}
4142

42-
// Needed by Gradle 4.6+ - see https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-gradle/
43-
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.3.0"
43+
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
44+
testImplementation "org.apache.kafka:connect-api:${kafkaVersion}"
45+
testImplementation "org.apache.kafka:connect-json:${kafkaVersion}"
4446

45-
// Forcing logback to be used for test logging
46-
testRuntime "ch.qos.logback:logback-classic:1.1.8"
47-
testRuntime group: "org.slf4j", name: "jcl-over-slf4j", version: "1.7.22"
48-
testRuntime group: "org.slf4j", name: "slf4j-api", version: "1.7.22"
47+
// Forcing logback to be used for test logging
48+
testImplementation "ch.qos.logback:logback-classic:1.2.11"
49+
testImplementation "org.slf4j:jcl-over-slf4j:1.7.36"
50+
testImplementation "org.slf4j:slf4j-api:1.7.36"
4951

50-
documentation files('LICENSE.txt')
51-
documentation files('NOTICE.txt')
52-
documentation files('README.md')
52+
documentation files('LICENSE.txt')
53+
documentation files('NOTICE.txt')
54+
documentation files('README.md')
5355

54-
assets files('MarkLogic_logo.png')
55-
assets files('apache_logo.png')
56+
assets files('MarkLogic_logo.png')
57+
assets files('apache_logo.png')
5658
}
5759

5860
// Needed by Gradle 4.6+ - see https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-gradle/
5961
test {
60-
useJUnitPlatform()
62+
useJUnitPlatform()
6163
}
6264

63-
// Customize the Java plugin's jar task to produce a "fat" jar with all dependencies included
64-
jar {
65-
manifest {
66-
attributes 'Implementation-Title': 'Kafka-Connect-MarkLogic',
67-
'Implementation-Version': version
68-
}
69-
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
65+
shadowJar {
66+
// Exclude DHF source files
67+
exclude "hub-internal-artifacts/**"
68+
exclude "hub-internal-config/**"
69+
exclude "ml-config/**"
70+
exclude "ml-modules*/**"
71+
exclude "scaffolding/**"
7072
}
7173

72-
task copyJarToKafka(type: Copy) {
73-
description = "Used for local development and testing; copies the jar to your local Kafka install"
74-
from "build/libs"
75-
into "${kafkaHome}/libs"
74+
task copyJarToKafka(type: Copy, dependsOn: shadowJar) {
75+
description = "Used for local development and testing; copies the jar to your local Kafka install"
76+
from "build/libs"
77+
into "${kafkaHome}/libs"
7678
}
77-
copyJarToKafka.mustRunAfter(jar)
7879

7980
task copyPropertyFilesToKafka(type: Copy) {
80-
description = "Used for local development and testing; copies the properties files to your local Kafka install"
81-
from "config"
82-
into "${kafkaHome}/config"
81+
description = "Used for local development and testing; copies the properties files to your local Kafka install"
82+
from "config"
83+
into "${kafkaHome}/config"
8384
}
8485

8586
task deploy {
86-
description = "Used for local development and testing; builds the jar and copies it and the properties files to your local Kafka install"
87-
dependsOn = ["jar", "copyJarToKafka", "copyPropertyFilesToKafka"]
87+
description = "Used for local development and testing; builds the jar and copies it and the properties files to your local Kafka install"
88+
dependsOn = ["copyJarToKafka", "copyPropertyFilesToKafka"]
8889
}
8990

9091
// Tasks for building the archive required for submitting to the Confluence Connector Hub
91-
import org.apache.tools.ant.filters.*
92+
93+
import org.apache.tools.ant.filters.ReplaceTokens
94+
9295
def baseArchiveBuildDir = "build/connectorArchive"
9396
def baseArchiveName = "${componentOwner}-${componentName}-${version}"
9497
task connectorArchive_CopyManifestToBuildDirectory(type: Copy) {
95-
description = "Copy the project manifest into the root folder"
96-
group = 'connector archive'
98+
description = "Copy the project manifest into the root folder"
99+
group = 'connector archive'
97100

98-
from '.'
99-
include 'manifest.json'
100-
into "${baseArchiveBuildDir}/${baseArchiveName}"
101-
filter(ReplaceTokens, tokens:[CONFLUENT_USER:componentOwner, VERSION:version])
101+
from '.'
102+
include 'manifest.json'
103+
into "${baseArchiveBuildDir}/${baseArchiveName}"
104+
filter(ReplaceTokens, tokens: [CONFLUENT_USER: componentOwner, VERSION: version])
102105
}
103106

104107
task connectorArchive_CopyAssetsToBuildDirectory(type: Copy) {
105-
description = "Copy the project assets into the assets folder"
106-
group = 'connector archive'
108+
description = "Copy the project assets into the assets folder"
109+
group = 'connector archive'
107110

108-
from configurations.assets
109-
into "${baseArchiveBuildDir}/${baseArchiveName}/assets"
111+
from configurations.assets
112+
into "${baseArchiveBuildDir}/${baseArchiveName}/assets"
110113
}
111114

112115
task connectorArchive_CopyEtcToBuildDirectory(type: Copy) {
113-
description = "Copy the project support files into the etc folder"
114-
group = 'connector archive'
116+
description = "Copy the project support files into the etc folder"
117+
group = 'connector archive'
115118

116-
from 'config'
117-
include '*'
118-
into "${baseArchiveBuildDir}/${baseArchiveName}/etc"
119+
from 'config'
120+
include '*'
121+
into "${baseArchiveBuildDir}/${baseArchiveName}/etc"
119122
}
120123

121124
task connectorArchive_CopyDocumentationToBuildDirectory(type: Copy) {
122-
description = "Copy the project documentation into the doc folder"
123-
group = 'connector archive'
125+
description = "Copy the project documentation into the doc folder"
126+
group = 'connector archive'
124127

125-
from configurations.documentation
126-
into "${baseArchiveBuildDir}/${baseArchiveName}/doc"
128+
from configurations.documentation
129+
into "${baseArchiveBuildDir}/${baseArchiveName}/doc"
127130
}
128131

129132
task connectorArchive_CopyDependenciesToBuildDirectory(type: Copy) {
130-
description = "Copy the dependency jars into the lib folder"
131-
group = 'connector archive'
132-
dependsOn = [jar]
133+
description = "Copy the dependency jars into the lib folder"
134+
group = 'connector archive'
135+
dependsOn = [jar]
133136

134-
from jar
135-
from configurations.compile
136-
into "${baseArchiveBuildDir}/${baseArchiveName}/lib"
137+
from jar
138+
from configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }
139+
into "${baseArchiveBuildDir}/${baseArchiveName}/lib"
137140
}
138141

139142
task connectorArchive_BuildDirectory() {
140-
description = "Build the directory that will be used to create the Kafka Connector Archive"
141-
dependsOn = [connectorArchive_CopyManifestToBuildDirectory,
142-
connectorArchive_CopyDependenciesToBuildDirectory,
143-
connectorArchive_CopyDocumentationToBuildDirectory,
144-
connectorArchive_CopyEtcToBuildDirectory,
145-
connectorArchive_CopyAssetsToBuildDirectory]
146-
group = 'connector archive'
143+
description = "Build the directory that will be used to create the Kafka Connector Archive"
144+
dependsOn = [connectorArchive_CopyManifestToBuildDirectory,
145+
connectorArchive_CopyDependenciesToBuildDirectory,
146+
connectorArchive_CopyDocumentationToBuildDirectory,
147+
connectorArchive_CopyEtcToBuildDirectory,
148+
connectorArchive_CopyAssetsToBuildDirectory]
149+
group = 'connector archive'
147150
}
148151

149152
task connectorArchive(type: Zip, dependsOn: connectorArchive_BuildDirectory) {
150-
description = 'Build a Connector Hub for the Confluent Connector Hub'
151-
group = 'connector archive'
153+
description = 'Build a Connector Hub for the Confluent Connector Hub'
154+
group = 'connector archive'
152155

153-
from "${baseArchiveBuildDir}"
154-
include '**/*'
155-
archiveName "${baseArchiveName}.zip"
156-
destinationDir(file('build/distro'))
156+
from "${baseArchiveBuildDir}"
157+
include '**/*'
158+
archiveName "${baseArchiveName}.zip"
159+
destinationDir(file('build/distro'))
157160
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group=com.marklogic
2-
version=1.6.1
2+
version=1.7.0-SNAPSHOT
33

44
# For the Confluent Connector Archive
55
componentOwner=marklogic
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)