@@ -2,9 +2,8 @@ buildscript {
2
2
ext. kotlinVersion = ' 1.9.25'
3
3
ext. isCI = System . getenv(' GITHUB_ACTION' )
4
4
repositories {
5
- mavenCentral()
6
5
gradlePluginPortal()
7
- maven { url ' https://repo.spring.io/plugins-release-local ' }
6
+ mavenCentral()
8
7
if (version. endsWith(' SNAPSHOT' )) {
9
8
maven { url ' https://repo.spring.io/snapshot' }
10
9
}
@@ -17,12 +16,12 @@ buildscript {
17
16
18
17
plugins {
19
18
id ' base'
20
- id ' project-report'
21
19
id ' idea'
22
20
id ' org.ajoberstar.grgit' version ' 5.2.2'
23
21
id ' io.spring.nohttp' version ' 0.0.11'
24
22
id ' io.spring.dependency-management' version ' 1.1.6' apply false
25
23
id ' com.github.spotbugs' version ' 6.0.19'
24
+ id ' io.freefair.aggregate-javadoc' version ' 8.6'
26
25
}
27
26
28
27
apply plugin : ' io.spring.nohttp'
@@ -122,36 +121,55 @@ allprojects {
122
121
123
122
configure(javaProjects) { subproject ->
124
123
apply plugin : ' java-library'
125
- apply plugin : ' java'
126
- apply from : " ${ rootProject.projectDir} /gradle/publish-maven.gradle"
127
124
apply plugin : ' eclipse'
128
125
apply plugin : ' idea'
129
126
apply plugin : ' checkstyle'
130
127
apply plugin : ' kotlin'
131
128
apply plugin : ' kotlin-spring'
132
129
130
+ apply from : " ${ rootProject.projectDir} /gradle/publish-maven.gradle"
131
+
132
+ def scopeAttribute = Attribute . of(' dependency.scope' , String )
133
+
134
+ configurations {
135
+ optional {
136
+ attributes {
137
+ attribute(scopeAttribute, ' optional' )
138
+ }
139
+ }
140
+
141
+ compileClasspath. extendsFrom(optional)
142
+ testCompileClasspath. extendsFrom(optional)
143
+ testRuntimeClasspath. extendsFrom(optional)
144
+ }
145
+
146
+ components. java. addVariantsFromConfiguration(configurations. optional) {
147
+ mapToOptional()
148
+ }
149
+
133
150
java {
134
151
withJavadocJar()
135
152
withSourcesJar()
136
- registerFeature(' optional' ) {
137
- usingSourceSet(sourceSets. main)
138
- }
139
153
}
140
154
141
155
compileJava {
142
- sourceCompatibility = 17
143
- targetCompatibility = 17
156
+ options. release = 17
144
157
}
145
158
146
159
compileTestJava {
147
- sourceCompatibility = 17
160
+ sourceCompatibility = JavaVersion . VERSION_17
161
+ targetCompatibility = JavaVersion . VERSION_17
148
162
options. encoding = ' UTF-8'
149
163
}
150
164
151
165
eclipse. project. natures + = ' org.springframework.ide.eclipse.core.springnature'
152
166
153
167
// dependencies that are common across all java projects
154
168
dependencies {
169
+ attributesSchema {
170
+ attribute(scopeAttribute)
171
+ }
172
+
155
173
def spotbugsAnnotations = " com.github.spotbugs:spotbugs-annotations:${ spotbugs.toolVersion.get()} "
156
174
compileOnly spotbugsAnnotations
157
175
testCompileOnly spotbugsAnnotations
@@ -171,7 +189,7 @@ configure(javaProjects) { subproject ->
171
189
exclude group : ' org.hamcrest'
172
190
}
173
191
testImplementation " org.hamcrest:hamcrest-core:$hamcrestVersion "
174
- optionalApi " org.assertj:assertj-core:$assertjVersion "
192
+ optional " org.assertj:assertj-core:$assertjVersion "
175
193
}
176
194
177
195
// enable all compiler warnings; individual projects may customize further
@@ -188,7 +206,6 @@ configure(javaProjects) { subproject ->
188
206
189
207
maxHeapSize = ' 1536m'
190
208
useJUnitPlatform()
191
-
192
209
}
193
210
194
211
checkstyle {
@@ -205,7 +222,7 @@ configure(javaProjects) { subproject ->
205
222
}
206
223
}
207
224
208
- task updateCopyrights {
225
+ tasks . register( ' updateCopyrights' ) {
209
226
onlyIf { ! isCI }
210
227
inputs. files(modifiedFiles. filter { f -> f. path. contains(subproject. name) })
211
228
outputs. dir(' build/classes' )
@@ -278,29 +295,29 @@ project ('spring-kafka') {
278
295
exclude group : ' org.springframework'
279
296
}
280
297
api " org.apache.kafka:kafka-clients:$kafkaVersion "
281
- optionalApi " org.apache.kafka:kafka-streams:$kafkaVersion "
282
- optionalApi " org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinCoroutinesVersion "
283
- optionalApi ' com.fasterxml.jackson.core:jackson-core'
284
- optionalApi ' com.fasterxml.jackson.core:jackson-databind'
285
- optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
286
- optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
287
- optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-joda'
288
- optionalApi (' com.fasterxml.jackson.module:jackson-module-kotlin' ) {
298
+ api ' io.micrometer:micrometer-observation'
299
+ optional " org.apache.kafka:kafka-streams:$kafkaVersion "
300
+ optional " org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinCoroutinesVersion "
301
+ optional ' com.fasterxml.jackson.core:jackson-core'
302
+ optional ' com.fasterxml.jackson.core:jackson-databind'
303
+ optional ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
304
+ optional ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
305
+ optional ' com.fasterxml.jackson.datatype:jackson-datatype-joda'
306
+ optional (' com.fasterxml.jackson.module:jackson-module-kotlin' ) {
289
307
exclude group : ' org.jetbrains.kotlin'
290
308
}
291
309
292
310
// Spring Data projection message binding support
293
- optionalApi (" org.springframework.data:spring-data-commons" ) {
311
+ optional (" org.springframework.data:spring-data-commons" ) {
294
312
exclude group : ' org.springframework'
295
313
exclude group : ' io.micrometer'
296
314
}
297
- optionalApi " com.jayway.jsonpath:json-path:$jaywayJsonPathVersion "
315
+ optional " com.jayway.jsonpath:json-path:$jaywayJsonPathVersion "
298
316
299
- optionalApi ' io.projectreactor:reactor-core'
300
- optionalApi ' io.projectreactor.kafka:reactor-kafka'
301
- optionalApi ' io.micrometer:micrometer-core'
302
- api ' io.micrometer:micrometer-observation'
303
- optionalApi ' io.micrometer:micrometer-tracing'
317
+ optional ' io.projectreactor:reactor-core'
318
+ optional ' io.projectreactor.kafka:reactor-kafka'
319
+ optional ' io.micrometer:micrometer-core'
320
+ optional ' io.micrometer:micrometer-tracing'
304
321
305
322
testImplementation project (' :spring-kafka-test' )
306
323
testImplementation ' io.projectreactor:reactor-test'
@@ -326,9 +343,7 @@ project('spring-kafka-bom') {
326
343
dependencies {
327
344
constraints {
328
345
javaProjects. sort { " $it . name " }. each {
329
- if (it. name != ' spring-kafka-docs' ) {
330
- api it
331
- }
346
+ api it
332
347
}
333
348
}
334
349
}
@@ -369,12 +384,12 @@ project ('spring-kafka-test') {
369
384
}
370
385
api ' org.junit.jupiter:junit-jupiter-api'
371
386
api ' org.junit.platform:junit-platform-launcher'
372
- optionalApi " org.hamcrest:hamcrest-core:$hamcrestVersion "
373
- optionalApi " org.mockito:mockito-core:$mockitoVersion "
374
- optionalApi (" junit:junit:$junit4Version " ) {
387
+ optional " org.hamcrest:hamcrest-core:$hamcrestVersion "
388
+ optional " org.mockito:mockito-core:$mockitoVersion "
389
+ optional (" junit:junit:$junit4Version " ) {
375
390
exclude group : ' org.hamcrest' , module : ' hamcrest-core'
376
391
}
377
- optionalApi " org.apache.logging.log4j:log4j-core:$log4jVersion "
392
+ optional " org.apache.logging.log4j:log4j-core:$log4jVersion "
378
393
}
379
394
}
380
395
@@ -406,30 +421,34 @@ tasks.register('filterMetricsDocsContent', Copy) {
406
421
filter { line -> line. replaceAll(' org.springframework.kafka.support.micrometer.' , ' ' ). replaceAll(' ^Fully qualified n' , ' N' ) }
407
422
}
408
423
409
- tasks. register(' api' , Javadoc ) {
410
- group = ' Documentation'
411
- description = ' Generates aggregated Javadoc API documentation.'
424
+ dependencies {
425
+ javaProjects. each {
426
+ javadoc it
427
+ }
428
+ }
429
+
430
+ javadoc {
412
431
title = " ${ rootProject.description} ${ version} API"
413
432
options {
414
433
encoding = ' UTF-8'
415
- memberLevel = org.gradle.external.javadoc. JavadocMemberLevel. PROTECTED
434
+ memberLevel = JavadocMemberLevel . PROTECTED
416
435
author = true
417
- header = rootProject . description
436
+ header = project . description
418
437
use = true
419
438
overview = ' src/api/overview.html'
420
439
splitIndex = true
421
440
links(project. ext. javadocLinks)
422
441
addBooleanOption(' Xdoclint:syntax' , true ) // only check syntax with doclint
423
442
}
424
443
425
- source javaProjects. collect { project ->
426
- project. sourceSets. main. allJava
427
- }
428
-
429
- classpath = files(javaProjects. collect { project ->
430
- project. sourceSets. main. compileClasspath
431
- })
432
444
destinationDir = file(' build/api' )
445
+ classpath = files(). from { files(javaProjects. collect { it. sourceSets. main. compileClasspath }) }
446
+ }
447
+
448
+ tasks. register(' api' ) {
449
+ group = ' Documentation'
450
+ description = ' Generates aggregated Javadoc API documentation.'
451
+ dependsOn javadoc
433
452
}
434
453
435
454
tasks. register(' docsZip' , Zip ) {
@@ -442,7 +461,7 @@ tasks.register('docsZip', Zip) {
442
461
include ' changelog.txt'
443
462
}
444
463
445
- from(api ) {
464
+ from(javadoc ) {
446
465
into ' api'
447
466
}
448
467
}
0 commit comments