Skip to content

Commit 04851fa

Browse files
committed
Added Gradle tasks for installing the ML Connector and the Datagen connector in a local CP install
1 parent 2d6ddb4 commit 04851fa

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,12 @@ tool for local development and testing. Install it via the following:
9393

9494
confluent-hub install confluentinc/kafka-connect-datagen:0.6.0
9595

96-
Next, in order to build and deploy the MarkLogic Kafka connector to Confluent Platform, modify `confluentHome` in
97-
`gradle-local.properties` (create this file in the root of this project if it does not already exist) to point to
98-
where you extracted the Confluent Platform distribution - e.g.:
96+
Then build and install the connector to the Confluent Platform indicated by your $CONFLUENT_HOME environment variable:
9997

100-
confluentHome=/Users/myusername/confluent-7.4.0
101-
102-
Then build and copy the connector to the Confluent Platform directory that you configured above:
103-
104-
./gradlew clean copyConnectorToConfluent
98+
./gradlew clean installConnectorInConfluent
10599

106100
Note that any time you modify the MarkLogic Kafka connector code, you'll need to repeat the
107-
`./gradlew clean copyConnectorToConfluent` step. Note that `clean` is included to ensure that in case you've changed
101+
`./gradlew clean installConnectorInConfluent` step. Note that `clean` is included to ensure that in case you've changed
108102
any connector dependencies, old dependencies will not be included in the connector archive.
109103

110104
Next, start Confluent:
@@ -245,7 +239,7 @@ Platform will become unstable and no longer work. The [Confluent local docs](htt
245239
make reference to this - "The data that are produced are transient and are intended to be temporary".
246240

247241
It is thus advisable that after you copy a new instance of the MarkLogic Kafka connector into Confluent Platform (i.e.
248-
by running `./gradlew copyConnectorToConfluent`), you should destroy your local Confluent Platform instance (this
242+
by running `./gradlew installConnectorInConfluent`), you should destroy your local Confluent Platform instance (this
249243
will usually finish in around 15s):
250244

251245
./gradlew destroyLocalConfluent
@@ -255,7 +249,7 @@ following (this will usually finish in around 1m):
255249

256250
./gradlew setupLocalConfluent
257251

258-
Remember that if you've modified the connector code, you'll first need to run `./gradlew copyConnectorToConfluent`.
252+
Remember that if you've modified the connector code, you'll first need to run `./gradlew installConnectorInConfluent`.
259253

260254
Doing the above will provide the most reliable way to get a new and working instance of Confluent Platform with the
261255
MarkLogic Kafka connector installed.
@@ -265,7 +259,7 @@ and one task starts with "setup"):
265259

266260
./gradlew destroy setup
267261

268-
You may have luck with simply doing `confluent local services stop`, `./gradlew copyConnectorToConfluent`, and
262+
You may have luck with simply doing `confluent local services stop`, `./gradlew installConnectorInConfluent`, and
269263
`confluent local services start`, but this has so far not worked reliably - i.e. one of the Confluent Platform
270264
services (sometimes Schema Registry, sometimes Control Center) usually stops working.
271265

build.gradle

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,10 @@ task connectorArchive(type: Zip, dependsOn: connectorArchive_BuildDirectory, gro
224224
destinationDir(file('build/distro'))
225225
}
226226

227-
task deleteConnectorInConfluent(type: Delete) {
228-
description = "Must delete the existing connector to ensure no old dependencies are left in the connector folder"
229-
delete "${confluentHome}/share/confluent-hub-components/marklogic-kafka-marklogic-connector-${version}"
230-
}
231-
232-
task copyConnectorToConfluent(type: Copy, group: confluentTestingGroup, dependsOn: [connectorArchive_BuildDirectory, deleteConnectorInConfluent]) {
233-
description = "Build the connector archive and copy it to your local Confluent Platform"
234-
from baseArchiveBuildDir
235-
into "${confluentHome}/share/confluent-hub-components"
227+
task installConnectorInConfluent(type: Exec, group: confluentTestingGroup, dependsOn: [connectorArchive]) {
228+
description = "Uses 'Confluent-hub' to install the connector in your local Confluent Platform"
229+
commandLine "confluent-hub", "install", "--no-prompt", "build/distro/${baseArchiveName}.zip"
230+
ignoreExitValue = true
236231
}
237232

238233
// See https://docs.confluent.io/confluent-cli/current/command-reference/local/confluent_local_destroy.html

gradle.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ kafkaHome=
1010
kafkaMlUsername=
1111
kafkaMlPassword=
1212

13-
# Override in gradle-local.properties if testing with Confluent Platform
14-
confluentHome=
15-
1613
# Only used for testing
1714
mlConfigPaths=src/test/ml-config
1815
mlModulePaths=src/test/ml-modules

0 commit comments

Comments
 (0)