@@ -208,27 +208,18 @@ configure(javaProjects) { subproject ->
208
208
def scopeAttribute = Attribute . of(' dependency.scope' , String )
209
209
210
210
configurations {
211
- optional {
212
- attributes {
213
- attribute(scopeAttribute, ' optional' )
214
- }
215
- }
216
211
provided {
217
212
attributes {
218
213
attribute(scopeAttribute, ' provided' )
219
214
}
220
215
}
221
216
222
217
[compileClasspath, testCompileClasspath, testRuntimeClasspath]. each {
223
- it. extendsFrom(optional)
224
218
it. extendsFrom(provided)
225
219
}
226
220
}
227
221
228
222
components. java. with {
229
- it. addVariantsFromConfiguration(configurations. optional) {
230
- mapToOptional()
231
- }
232
223
it. addVariantsFromConfiguration(configurations. provided) {
233
224
mapToMavenScope(' compile' ) // This is temporary. Gradle doesn't natively support the provided scope
234
225
}
@@ -245,6 +236,9 @@ configure(javaProjects) { subproject ->
245
236
java {
246
237
withJavadocJar()
247
238
withSourcesJar()
239
+ registerFeature(' optional' ) {
240
+ usingSourceSet(sourceSets. main)
241
+ }
248
242
}
249
243
250
244
compileJava {
@@ -473,19 +467,19 @@ project('spring-integration-test-support') {
473
467
api ' org.springframework:spring-context'
474
468
api ' org.springframework:spring-messaging'
475
469
api ' org.springframework:spring-test'
476
- optional (" junit:junit:$junit4Version " ) {
470
+ optionalApi (" junit:junit:$junit4Version " ) {
477
471
exclude group : ' org.hamcrest'
478
472
}
479
- optional ' org.junit.jupiter:junit-jupiter-api'
480
- optional ' org.apache.logging.log4j:log4j-core'
473
+ optionalApi ' org.junit.jupiter:junit-jupiter-api'
474
+ optionalApi ' org.apache.logging.log4j:log4j-core'
481
475
}
482
476
}
483
477
484
478
project(' spring-integration-amqp' ) {
485
479
description = ' Spring Integration AMQP Support'
486
480
dependencies {
487
481
api ' org.springframework.amqp:spring-rabbit'
488
- optional ' org.springframework.amqp:spring-rabbit-stream'
482
+ optionalApi ' org.springframework.amqp:spring-rabbit-stream'
489
483
490
484
testImplementation ' org.springframework.amqp:spring-rabbit-junit'
491
485
testImplementation project(' :spring-integration-stream' )
@@ -536,23 +530,23 @@ project('spring-integration-core') {
536
530
api ' io.projectreactor:reactor-core'
537
531
api ' io.micrometer:micrometer-observation'
538
532
539
- optional ' com.fasterxml.jackson.core:jackson-databind'
540
- optional ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
541
- optional ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
542
- optional ' com.fasterxml.jackson.datatype:jackson-datatype-joda'
543
- optional (' com.fasterxml.jackson.module:jackson-module-kotlin' ) {
533
+ optionalApi ' com.fasterxml.jackson.core:jackson-databind'
534
+ optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
535
+ optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
536
+ optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-joda'
537
+ optionalApi (' com.fasterxml.jackson.module:jackson-module-kotlin' ) {
544
538
exclude group : ' org.jetbrains.kotlin'
545
539
}
546
- optional " com.google.protobuf:protobuf-java:$protobufVersion "
547
- optional " com.jayway.jsonpath:json-path:$jsonpathVersion "
548
- optional " com.esotericsoftware:kryo:$kryoVersion "
549
- optional ' io.micrometer:micrometer-core'
550
- optional (' io.micrometer:micrometer-tracing' ) {
540
+ optionalApi " com.google.protobuf:protobuf-java:$protobufVersion "
541
+ optionalApi " com.jayway.jsonpath:json-path:$jsonpathVersion "
542
+ optionalApi " com.esotericsoftware:kryo:$kryoVersion "
543
+ optionalApi ' io.micrometer:micrometer-core'
544
+ optionalApi (' io.micrometer:micrometer-tracing' ) {
551
545
exclude group : ' aopalliance'
552
546
}
553
- optional " io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion "
554
- optional " org.apache.avro:avro:$avroVersion "
555
- optional ' org.jetbrains.kotlinx:kotlinx-coroutines-reactor'
547
+ optionalApi " io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion "
548
+ optionalApi " org.apache.avro:avro:$avroVersion "
549
+ optionalApi ' org.jetbrains.kotlinx:kotlinx-coroutines-reactor'
556
550
557
551
testImplementation " com.google.protobuf:protobuf-java-util:$protobufVersion "
558
552
testImplementation " org.aspectj:aspectjweaver:$aspectjVersion "
@@ -640,7 +634,7 @@ project('spring-integration-ftp') {
640
634
api project(' :spring-integration-file' )
641
635
api " commons-net:commons-net:$commonsNetVersion "
642
636
api ' org.springframework:spring-context-support'
643
- optional " org.apache.ftpserver:ftpserver-core:$ftpServerVersion "
637
+ optionalApi " org.apache.ftpserver:ftpserver-core:$ftpServerVersion "
644
638
645
639
testImplementation project(' :spring-integration-file' ). sourceSets. test. output
646
640
}
@@ -700,8 +694,8 @@ project('spring-integration-http') {
700
694
dependencies {
701
695
api ' org.springframework:spring-webmvc'
702
696
provided " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
703
- optional " com.rometools:rome:$romeToolsVersion "
704
- optional ' org.springframework:spring-webflux'
697
+ optionalApi " com.rometools:rome:$romeToolsVersion "
698
+ optionalApi ' org.springframework:spring-webflux'
705
699
706
700
testImplementation " org.hamcrest:hamcrest-core:$hamcrestVersion "
707
701
testImplementation ' org.springframework.security:spring-security-messaging'
@@ -733,7 +727,7 @@ project('spring-integration-jdbc') {
733
727
description = ' Spring Integration JDBC Support'
734
728
dependencies {
735
729
api ' org.springframework:spring-jdbc'
736
- optional " org.postgresql:postgresql:$postgresVersion "
730
+ optionalApi " org.postgresql:postgresql:$postgresVersion "
737
731
738
732
testImplementation " com.h2database:h2:$h2Version "
739
733
testImplementation " org.hsqldb:hsqldb:$hsqldbVersion "
@@ -781,7 +775,7 @@ project('spring-integration-jpa') {
781
775
description = ' Spring Integration JPA Support'
782
776
dependencies {
783
777
api ' org.springframework:spring-orm'
784
- optional " jakarta.persistence:jakarta.persistence-api:$jpaApiVersion "
778
+ optionalApi " jakarta.persistence:jakarta.persistence-api:$jpaApiVersion "
785
779
786
780
testImplementation ' org.springframework.data:spring-data-jpa'
787
781
testImplementation " com.h2database:h2:$h2Version "
@@ -817,8 +811,8 @@ project('spring-integration-mongodb') {
817
811
dependencies {
818
812
api ' org.springframework.data:spring-data-mongodb'
819
813
820
- optional " org.mongodb:mongodb-driver-sync:$mongoDriverVersion "
821
- optional " org.mongodb:mongodb-driver-reactivestreams:$mongoDriverVersion "
814
+ optionalApi " org.mongodb:mongodb-driver-sync:$mongoDriverVersion "
815
+ optionalApi " org.mongodb:mongodb-driver-reactivestreams:$mongoDriverVersion "
822
816
823
817
testImplementation ' org.testcontainers:mongodb'
824
818
}
@@ -839,7 +833,7 @@ project('spring-integration-mqtt') {
839
833
dependencies {
840
834
api " org.eclipse.paho:org.eclipse.paho.client.mqttv3:$pahoMqttClientVersion "
841
835
842
- optional " org.eclipse.paho:org.eclipse.paho.mqttv5.client:$pahoMqttClientVersion "
836
+ optionalApi " org.eclipse.paho:org.eclipse.paho.mqttv5.client:$pahoMqttClientVersion "
843
837
844
838
testImplementation project(' :spring-integration-jmx' )
845
839
testImplementation ' com.fasterxml.jackson.core:jackson-databind'
@@ -869,7 +863,7 @@ project('spring-integration-rsocket') {
869
863
project(' spring-integration-scripting' ) {
870
864
description = ' Spring Integration Scripting Support'
871
865
dependencies {
872
- optional ' org.jetbrains.kotlin:kotlin-scripting-jsr223'
866
+ optionalApi ' org.jetbrains.kotlin:kotlin-scripting-jsr223'
873
867
provided " org.graalvm.sdk:graal-sdk:$graalvmVersion "
874
868
provided " org.graalvm.polyglot:js:$graalvmVersion "
875
869
@@ -915,7 +909,7 @@ project('spring-integration-smb') {
915
909
project(' spring-integration-stomp' ) {
916
910
description = ' Spring Integration STOMP Support'
917
911
dependencies {
918
- optional ' org.springframework:spring-websocket'
912
+ optionalApi ' org.springframework:spring-websocket'
919
913
920
914
testImplementation project(' :spring-integration-websocket' )
921
915
testImplementation project(' :spring-integration-websocket' ). sourceSets. test. output
@@ -967,7 +961,7 @@ project('spring-integration-webflux') {
967
961
exclude group : ' org.springframework' , module : ' spring-webmvc'
968
962
}
969
963
api ' org.springframework:spring-webflux'
970
- optional ' io.projectreactor.netty:reactor-netty-http'
964
+ optionalApi ' io.projectreactor.netty:reactor-netty-http'
971
965
972
966
testImplementation " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
973
967
testImplementation " org.hamcrest:hamcrest-core:$hamcrestVersion "
@@ -990,7 +984,7 @@ project('spring-integration-websocket') {
990
984
description = ' Spring Integration WebSockets Support'
991
985
dependencies {
992
986
api ' org.springframework:spring-websocket'
993
- optional ' org.springframework:spring-webmvc'
987
+ optionalApi ' org.springframework:spring-webmvc'
994
988
provided " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
995
989
996
990
testImplementation project(' :spring-integration-event' )
@@ -1037,7 +1031,7 @@ project('spring-integration-xml') {
1037
1031
api(' org.springframework.ws:spring-xml' ) {
1038
1032
exclude group : ' org.springframework'
1039
1033
}
1040
- optional (' org.springframework.ws:spring-ws-core' ) {
1034
+ optionalApi (' org.springframework.ws:spring-ws-core' ) {
1041
1035
exclude group : ' org.springframework'
1042
1036
}
1043
1037
@@ -1067,7 +1061,7 @@ project('spring-integration-zeromq') {
1067
1061
dependencies {
1068
1062
api " org.zeromq:jeromq:$jeroMqVersion "
1069
1063
1070
- optional ' com.fasterxml.jackson.core:jackson-databind'
1064
+ optionalApi ' com.fasterxml.jackson.core:jackson-databind'
1071
1065
}
1072
1066
}
1073
1067
0 commit comments