|
1 | 1 | 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" |
5 | 6 | } |
6 | 7 |
|
7 | | -sourceCompatibility = 1.8 |
| 8 | +java { |
| 9 | + sourceCompatibility = 1.8 |
| 10 | + targetCompatibility = 1.8 |
| 11 | +} |
8 | 12 |
|
9 | 13 | repositories { |
10 | | - mavenCentral() |
11 | | - jcenter() |
| 14 | + mavenCentral() |
12 | 15 | } |
13 | 16 |
|
14 | 17 | configurations { |
15 | | - documentation |
16 | | - assets |
| 18 | + documentation |
| 19 | + assets |
| 20 | +} |
| 21 | + |
| 22 | +ext { |
| 23 | + kafkaVersion = "2.8.1" |
17 | 24 | } |
18 | 25 |
|
19 | 26 | 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}" |
22 | 29 |
|
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" |
32 | 31 |
|
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" |
36 | 38 |
|
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 | + } |
41 | 42 |
|
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}" |
44 | 46 |
|
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" |
49 | 51 |
|
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') |
53 | 55 |
|
54 | | - assets files('MarkLogic_logo.png') |
55 | | - assets files('apache_logo.png') |
| 56 | + assets files('MarkLogic_logo.png') |
| 57 | + assets files('apache_logo.png') |
56 | 58 | } |
57 | 59 |
|
58 | 60 | // Needed by Gradle 4.6+ - see https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-gradle/ |
59 | 61 | test { |
60 | | - useJUnitPlatform() |
| 62 | + useJUnitPlatform() |
61 | 63 | } |
62 | 64 |
|
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/**" |
70 | 72 | } |
71 | 73 |
|
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" |
76 | 78 | } |
77 | | -copyJarToKafka.mustRunAfter(jar) |
78 | 79 |
|
79 | 80 | 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" |
83 | 84 | } |
84 | 85 |
|
85 | 86 | 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"] |
88 | 89 | } |
89 | 90 |
|
90 | 91 | // 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 | + |
92 | 95 | def baseArchiveBuildDir = "build/connectorArchive" |
93 | 96 | def baseArchiveName = "${componentOwner}-${componentName}-${version}" |
94 | 97 | 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' |
97 | 100 |
|
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]) |
102 | 105 | } |
103 | 106 |
|
104 | 107 | 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' |
107 | 110 |
|
108 | | - from configurations.assets |
109 | | - into "${baseArchiveBuildDir}/${baseArchiveName}/assets" |
| 111 | + from configurations.assets |
| 112 | + into "${baseArchiveBuildDir}/${baseArchiveName}/assets" |
110 | 113 | } |
111 | 114 |
|
112 | 115 | 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' |
115 | 118 |
|
116 | | - from 'config' |
117 | | - include '*' |
118 | | - into "${baseArchiveBuildDir}/${baseArchiveName}/etc" |
| 119 | + from 'config' |
| 120 | + include '*' |
| 121 | + into "${baseArchiveBuildDir}/${baseArchiveName}/etc" |
119 | 122 | } |
120 | 123 |
|
121 | 124 | 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' |
124 | 127 |
|
125 | | - from configurations.documentation |
126 | | - into "${baseArchiveBuildDir}/${baseArchiveName}/doc" |
| 128 | + from configurations.documentation |
| 129 | + into "${baseArchiveBuildDir}/${baseArchiveName}/doc" |
127 | 130 | } |
128 | 131 |
|
129 | 132 | 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] |
133 | 136 |
|
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" |
137 | 140 | } |
138 | 141 |
|
139 | 142 | 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' |
147 | 150 | } |
148 | 151 |
|
149 | 152 | 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' |
152 | 155 |
|
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')) |
157 | 160 | } |
0 commit comments