@@ -204,6 +204,30 @@ configure(javaProjects) { subproject ->
204
204
205
205
apply from : " ${ rootDir} /gradle/publish-maven.gradle"
206
206
207
+ def scopeAttribute = Attribute . of(' dependency.scope' , String )
208
+
209
+ configurations {
210
+ optional {
211
+ attributes {
212
+ attribute(scopeAttribute, ' optional' )
213
+ }
214
+ }
215
+ provided {
216
+ attributes {
217
+ attribute(scopeAttribute, ' provided' )
218
+ }
219
+ }
220
+ }
221
+
222
+ components. java. with {
223
+ it. addVariantsFromConfiguration(configurations. optional) {
224
+ mapToOptional()
225
+ }
226
+ it. addVariantsFromConfiguration(configurations. provided) {
227
+ mapToMavenScope(' compile' ) // This is temporary. Gradle doesn't natively support the provided scope
228
+ }
229
+ }
230
+
207
231
sourceSets {
208
232
test {
209
233
resources {
@@ -212,15 +236,16 @@ configure(javaProjects) { subproject ->
212
236
}
213
237
}
214
238
239
+ [configurations. optional, configurations. provided]. each { scoped ->
240
+ sourceSets. all {
241
+ compileClasspath + = scoped
242
+ runtimeClasspath + = scoped
243
+ }
244
+ }
245
+
215
246
java {
216
247
withJavadocJar()
217
248
withSourcesJar()
218
- registerFeature(' optional' ) {
219
- usingSourceSet(sourceSets. main)
220
- }
221
- registerFeature(' provided' ) {
222
- usingSourceSet(sourceSets. main)
223
- }
224
249
}
225
250
226
251
compileJava {
@@ -256,6 +281,10 @@ configure(javaProjects) { subproject ->
256
281
257
282
// dependencies that are common across all java projects
258
283
dependencies {
284
+ attributesSchema {
285
+ attribute(scopeAttribute)
286
+ }
287
+
259
288
if (! (subproject. name ==~ / .*-test.*/ )) {
260
289
testImplementation(project(' :spring-integration-test-support' )) {
261
290
exclude group : ' org.hamcrest'
@@ -426,14 +455,8 @@ configure(javaProjects) { subproject ->
426
455
from components. java
427
456
pom. withXml {
428
457
def pomDeps = asNode(). dependencies. first()
429
- subproject. configurations. providedImplementation. allDependencies. each { dep ->
430
- pomDeps. remove(pomDeps. ' *' . find { it. artifactId. text() == dep. name })
431
- pomDeps. appendNode(' dependency' ). with {
432
- it. appendNode(' groupId' , dep. group)
433
- it. appendNode(' artifactId' , dep. name)
434
- it. appendNode(' version' , dep. version)
435
- it. appendNode(' scope' , ' provided' )
436
- }
458
+ subproject. configurations. provided. allDependencies. each { dep ->
459
+ pomDeps. ' *' . find { it. artifactId. text() == dep. name }. scope. first(). value = ' provided'
437
460
}
438
461
}
439
462
}
@@ -451,19 +474,19 @@ project('spring-integration-test-support') {
451
474
api ' org.springframework:spring-context'
452
475
api ' org.springframework:spring-messaging'
453
476
api ' org.springframework:spring-test'
454
- optionalApi (" junit:junit:$junit4Version " ) {
477
+ optional (" junit:junit:$junit4Version " ) {
455
478
exclude group : ' org.hamcrest'
456
479
}
457
- optionalApi ' org.junit.jupiter:junit-jupiter-api'
458
- optionalApi ' org.apache.logging.log4j:log4j-core'
480
+ optional ' org.junit.jupiter:junit-jupiter-api'
481
+ optional ' org.apache.logging.log4j:log4j-core'
459
482
}
460
483
}
461
484
462
485
project(' spring-integration-amqp' ) {
463
486
description = ' Spring Integration AMQP Support'
464
487
dependencies {
465
488
api ' org.springframework.amqp:spring-rabbit'
466
- optionalApi ' org.springframework.amqp:spring-rabbit-stream'
489
+ optional ' org.springframework.amqp:spring-rabbit-stream'
467
490
468
491
testImplementation ' org.springframework.amqp:spring-rabbit-junit'
469
492
testImplementation project(' :spring-integration-stream' )
@@ -514,23 +537,23 @@ project('spring-integration-core') {
514
537
api ' io.projectreactor:reactor-core'
515
538
api ' io.micrometer:micrometer-observation'
516
539
517
- optionalApi ' com.fasterxml.jackson.core:jackson-databind'
518
- optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
519
- optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
520
- optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-joda'
521
- optionalApi (' com.fasterxml.jackson.module:jackson-module-kotlin' ) {
540
+ optional ' com.fasterxml.jackson.core:jackson-databind'
541
+ optional ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
542
+ optional ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
543
+ optional ' com.fasterxml.jackson.datatype:jackson-datatype-joda'
544
+ optional (' com.fasterxml.jackson.module:jackson-module-kotlin' ) {
522
545
exclude group : ' org.jetbrains.kotlin'
523
546
}
524
- optionalApi " com.google.protobuf:protobuf-java:$protobufVersion "
525
- optionalApi " com.jayway.jsonpath:json-path:$jsonpathVersion "
526
- optionalApi " com.esotericsoftware:kryo:$kryoVersion "
527
- optionalApi ' io.micrometer:micrometer-core'
528
- optionalApi (' io.micrometer:micrometer-tracing' ) {
547
+ optional " com.google.protobuf:protobuf-java:$protobufVersion "
548
+ optional " com.jayway.jsonpath:json-path:$jsonpathVersion "
549
+ optional " com.esotericsoftware:kryo:$kryoVersion "
550
+ optional ' io.micrometer:micrometer-core'
551
+ optional (' io.micrometer:micrometer-tracing' ) {
529
552
exclude group : ' aopalliance'
530
553
}
531
- optionalApi " io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion "
532
- optionalApi " org.apache.avro:avro:$avroVersion "
533
- optionalApi ' org.jetbrains.kotlinx:kotlinx-coroutines-reactor'
554
+ optional " io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion "
555
+ optional " org.apache.avro:avro:$avroVersion "
556
+ optional ' org.jetbrains.kotlinx:kotlinx-coroutines-reactor'
534
557
535
558
testImplementation " com.google.protobuf:protobuf-java-util:$protobufVersion "
536
559
testImplementation " org.aspectj:aspectjweaver:$aspectjVersion "
@@ -543,7 +566,7 @@ project('spring-integration-core') {
543
566
}
544
567
545
568
dokkaHtmlPartial {
546
- outputDirectory. set(new File (buildDir , ' kdoc' ))
569
+ outputDirectory. set(new File (' build ' , ' kdoc' ))
547
570
dokkaSourceSets {
548
571
main {
549
572
sourceRoots. setFrom(file(' src/main/kotlin' ))
@@ -618,7 +641,7 @@ project('spring-integration-ftp') {
618
641
api project(' :spring-integration-file' )
619
642
api " commons-net:commons-net:$commonsNetVersion "
620
643
api ' org.springframework:spring-context-support'
621
- optionalApi " org.apache.ftpserver:ftpserver-core:$ftpServerVersion "
644
+ optional " org.apache.ftpserver:ftpserver-core:$ftpServerVersion "
622
645
623
646
testImplementation project(' :spring-integration-file' ). sourceSets. test. output
624
647
}
@@ -677,9 +700,9 @@ project('spring-integration-http') {
677
700
description = ' Spring Integration HTTP Support'
678
701
dependencies {
679
702
api ' org.springframework:spring-webmvc'
680
- providedImplementation " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
681
- optionalApi " com.rometools:rome:$romeToolsVersion "
682
- optionalApi ' org.springframework:spring-webflux'
703
+ provided " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
704
+ optional " com.rometools:rome:$romeToolsVersion "
705
+ optional ' org.springframework:spring-webflux'
683
706
684
707
testImplementation " org.hamcrest:hamcrest-core:$hamcrestVersion "
685
708
testImplementation ' org.springframework.security:spring-security-messaging'
@@ -711,7 +734,7 @@ project('spring-integration-jdbc') {
711
734
description = ' Spring Integration JDBC Support'
712
735
dependencies {
713
736
api ' org.springframework:spring-jdbc'
714
- optionalApi " org.postgresql:postgresql:$postgresVersion "
737
+ optional " org.postgresql:postgresql:$postgresVersion "
715
738
716
739
testImplementation " com.h2database:h2:$h2Version "
717
740
testImplementation " org.hsqldb:hsqldb:$hsqldbVersion "
@@ -736,7 +759,7 @@ project('spring-integration-jms') {
736
759
description = ' Spring Integration JMS Support'
737
760
dependencies {
738
761
api ' org.springframework:spring-jms'
739
- providedImplementation " jakarta.jms:jakarta.jms-api:$jmsApiVersion "
762
+ provided " jakarta.jms:jakarta.jms-api:$jmsApiVersion "
740
763
741
764
testImplementation(" org.apache.activemq:artemis-server:$artemisVersion " ) {
742
765
exclude group : ' org.jboss.logmanager'
@@ -759,7 +782,7 @@ project('spring-integration-jpa') {
759
782
description = ' Spring Integration JPA Support'
760
783
dependencies {
761
784
api ' org.springframework:spring-orm'
762
- optionalApi " jakarta.persistence:jakarta.persistence-api:$jpaApiVersion "
785
+ optional " jakarta.persistence:jakarta.persistence-api:$jpaApiVersion "
763
786
764
787
testImplementation ' org.springframework.data:spring-data-jpa'
765
788
testImplementation " com.h2database:h2:$h2Version "
@@ -782,7 +805,7 @@ project('spring-integration-mail') {
782
805
dependencies {
783
806
api ' org.springframework:spring-context-support'
784
807
785
- providedImplementation " org.eclipse.angus:jakarta.mail:$mailVersion "
808
+ provided " org.eclipse.angus:jakarta.mail:$mailVersion "
786
809
787
810
testImplementation " com.icegreen:greenmail:$greenmailVersion "
788
811
@@ -795,8 +818,8 @@ project('spring-integration-mongodb') {
795
818
dependencies {
796
819
api ' org.springframework.data:spring-data-mongodb'
797
820
798
- optionalApi " org.mongodb:mongodb-driver-sync:$mongoDriverVersion "
799
- optionalApi " org.mongodb:mongodb-driver-reactivestreams:$mongoDriverVersion "
821
+ optional " org.mongodb:mongodb-driver-sync:$mongoDriverVersion "
822
+ optional " org.mongodb:mongodb-driver-reactivestreams:$mongoDriverVersion "
800
823
801
824
testImplementation ' org.testcontainers:mongodb'
802
825
}
@@ -817,7 +840,7 @@ project('spring-integration-mqtt') {
817
840
dependencies {
818
841
api " org.eclipse.paho:org.eclipse.paho.client.mqttv3:$pahoMqttClientVersion "
819
842
820
- optionalApi " org.eclipse.paho:org.eclipse.paho.mqttv5.client:$pahoMqttClientVersion "
843
+ optional " org.eclipse.paho:org.eclipse.paho.mqttv5.client:$pahoMqttClientVersion "
821
844
822
845
testImplementation project(' :spring-integration-jmx' )
823
846
testImplementation ' com.fasterxml.jackson.core:jackson-databind'
@@ -847,9 +870,9 @@ project('spring-integration-rsocket') {
847
870
project(' spring-integration-scripting' ) {
848
871
description = ' Spring Integration Scripting Support'
849
872
dependencies {
850
- optionalApi ' org.jetbrains.kotlin:kotlin-scripting-jsr223'
851
- providedImplementation " org.graalvm.sdk:graal-sdk:$graalvmVersion "
852
- providedImplementation " org.graalvm.polyglot:js:$graalvmVersion "
873
+ optional ' org.jetbrains.kotlin:kotlin-scripting-jsr223'
874
+ provided " org.graalvm.sdk:graal-sdk:$graalvmVersion "
875
+ provided " org.graalvm.polyglot:js:$graalvmVersion "
853
876
854
877
testImplementation " org.jruby:jruby-complete:$jrubyVersion "
855
878
testImplementation ' org.apache.groovy:groovy-jsr223'
@@ -893,7 +916,7 @@ project('spring-integration-smb') {
893
916
project(' spring-integration-stomp' ) {
894
917
description = ' Spring Integration STOMP Support'
895
918
dependencies {
896
- optionalApi ' org.springframework:spring-websocket'
919
+ optional ' org.springframework:spring-websocket'
897
920
898
921
testImplementation project(' :spring-integration-websocket' )
899
922
testImplementation project(' :spring-integration-websocket' ). sourceSets. test. output
@@ -945,7 +968,7 @@ project('spring-integration-webflux') {
945
968
exclude group : ' org.springframework' , module : ' spring-webmvc'
946
969
}
947
970
api ' org.springframework:spring-webflux'
948
- optionalApi ' io.projectreactor.netty:reactor-netty-http'
971
+ optional ' io.projectreactor.netty:reactor-netty-http'
949
972
950
973
testImplementation " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
951
974
testImplementation " org.hamcrest:hamcrest-core:$hamcrestVersion "
@@ -968,8 +991,8 @@ project('spring-integration-websocket') {
968
991
description = ' Spring Integration WebSockets Support'
969
992
dependencies {
970
993
api ' org.springframework:spring-websocket'
971
- optionalApi ' org.springframework:spring-webmvc'
972
- providedImplementation " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
994
+ optional ' org.springframework:spring-webmvc'
995
+ provided " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
973
996
974
997
testImplementation project(' :spring-integration-event' )
975
998
testImplementation " org.apache.tomcat.embed:tomcat-embed-websocket:$tomcatVersion "
@@ -994,7 +1017,7 @@ project('spring-integration-ws') {
994
1017
exclude group : ' org.glassfish.jaxb'
995
1018
}
996
1019
997
- providedImplementation " com.sun.xml.bind:jaxb-impl:$jaxbVersion "
1020
+ provided " com.sun.xml.bind:jaxb-impl:$jaxbVersion "
998
1021
999
1022
testImplementation " com.thoughtworks.xstream:xstream:$xstreamVersion "
1000
1023
testImplementation(' org.springframework.ws:spring-ws-support' ) {
@@ -1015,7 +1038,7 @@ project('spring-integration-xml') {
1015
1038
api(' org.springframework.ws:spring-xml' ) {
1016
1039
exclude group : ' org.springframework'
1017
1040
}
1018
- optionalApi (' org.springframework.ws:spring-ws-core' ) {
1041
+ optional (' org.springframework.ws:spring-ws-core' ) {
1019
1042
exclude group : ' org.springframework'
1020
1043
}
1021
1044
@@ -1045,7 +1068,7 @@ project('spring-integration-zeromq') {
1045
1068
dependencies {
1046
1069
api " org.zeromq:jeromq:$jeroMqVersion "
1047
1070
1048
- optionalApi ' com.fasterxml.jackson.core:jackson-databind'
1071
+ optional ' com.fasterxml.jackson.core:jackson-databind'
1049
1072
}
1050
1073
}
1051
1074
@@ -1109,10 +1132,9 @@ tasks.register('api', Javadoc) {
1109
1132
source javaProjects. collect { project ->
1110
1133
project. sourceSets. main. allJava
1111
1134
}
1112
- destinationDir = new File (buildDir, ' api' )
1113
- classpath = files(javaProjects. collect { project ->
1114
- project. sourceSets. main. compileClasspath
1115
- })
1135
+ destinationDir = new File (' build' , ' api' )
1136
+ classpath = files(). from { files(javaProjects. collect { it. sourceSets. main. compileClasspath }) }
1137
+
1116
1138
}
1117
1139
1118
1140
dokkaHtmlMultiModule {
0 commit comments