@@ -194,6 +194,30 @@ configure(javaProjects) { subproject ->
194
194
195
195
apply from : " ${ rootDir} /gradle/publish-maven.gradle"
196
196
197
+ def scopeAttribute = Attribute . of(' dependency.scope' , String )
198
+
199
+ configurations {
200
+ optional {
201
+ attributes {
202
+ attribute(scopeAttribute, ' optional' )
203
+ }
204
+ }
205
+ provided {
206
+ attributes {
207
+ attribute(scopeAttribute, ' provided' )
208
+ }
209
+ }
210
+ }
211
+
212
+ components. java. with {
213
+ it. addVariantsFromConfiguration(configurations. optional) {
214
+ mapToOptional()
215
+ }
216
+ it. addVariantsFromConfiguration(configurations. provided) {
217
+ mapToMavenScope(' compile' ) // This is temporary. Gradle doesn't natively support the provided scope
218
+ }
219
+ }
220
+
197
221
sourceSets {
198
222
test {
199
223
resources {
@@ -202,15 +226,16 @@ configure(javaProjects) { subproject ->
202
226
}
203
227
}
204
228
229
+ [configurations. optional, configurations. provided]. each { scoped ->
230
+ sourceSets. all {
231
+ compileClasspath + = scoped
232
+ runtimeClasspath + = scoped
233
+ }
234
+ }
235
+
205
236
java {
206
237
withJavadocJar()
207
238
withSourcesJar()
208
- registerFeature(' optional' ) {
209
- usingSourceSet(sourceSets. main)
210
- }
211
- registerFeature(' provided' ) {
212
- usingSourceSet(sourceSets. main)
213
- }
214
239
}
215
240
216
241
compileJava {
@@ -246,6 +271,10 @@ configure(javaProjects) { subproject ->
246
271
247
272
// dependencies that are common across all java projects
248
273
dependencies {
274
+ attributesSchema {
275
+ attribute(scopeAttribute)
276
+ }
277
+
249
278
if (! (subproject. name ==~ / .*-test.*/ )) {
250
279
testImplementation(project(' :spring-integration-test-support' )) {
251
280
exclude group : ' org.hamcrest'
@@ -416,14 +445,8 @@ configure(javaProjects) { subproject ->
416
445
from components. java
417
446
pom. withXml {
418
447
def pomDeps = asNode(). dependencies. first()
419
- subproject. configurations. providedImplementation. allDependencies. each { dep ->
420
- pomDeps. remove(pomDeps. ' *' . find { it. artifactId. text() == dep. name })
421
- pomDeps. appendNode(' dependency' ). with {
422
- it. appendNode(' groupId' , dep. group)
423
- it. appendNode(' artifactId' , dep. name)
424
- it. appendNode(' version' , dep. version)
425
- it. appendNode(' scope' , ' provided' )
426
- }
448
+ subproject. configurations. provided. allDependencies. each { dep ->
449
+ pomDeps. ' *' . find { it. artifactId. text() == dep. name }. scope. first(). value = ' provided'
427
450
}
428
451
}
429
452
}
@@ -441,19 +464,19 @@ project('spring-integration-test-support') {
441
464
api ' org.springframework:spring-context'
442
465
api ' org.springframework:spring-messaging'
443
466
api ' org.springframework:spring-test'
444
- optionalApi (" junit:junit:$junit4Version " ) {
467
+ optional (" junit:junit:$junit4Version " ) {
445
468
exclude group : ' org.hamcrest'
446
469
}
447
- optionalApi ' org.junit.jupiter:junit-jupiter-api'
448
- optionalApi ' org.apache.logging.log4j:log4j-core'
470
+ optional ' org.junit.jupiter:junit-jupiter-api'
471
+ optional ' org.apache.logging.log4j:log4j-core'
449
472
}
450
473
}
451
474
452
475
project(' spring-integration-amqp' ) {
453
476
description = ' Spring Integration AMQP Support'
454
477
dependencies {
455
478
api ' org.springframework.amqp:spring-rabbit'
456
- optionalApi ' org.springframework.amqp:spring-rabbit-stream'
479
+ optional ' org.springframework.amqp:spring-rabbit-stream'
457
480
458
481
testImplementation ' org.springframework.amqp:spring-rabbit-junit'
459
482
testImplementation project(' :spring-integration-stream' )
@@ -503,23 +526,23 @@ project('spring-integration-core') {
503
526
api ' io.projectreactor:reactor-core'
504
527
api ' io.micrometer:micrometer-observation'
505
528
506
- optionalApi ' com.fasterxml.jackson.core:jackson-databind'
507
- optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
508
- optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
509
- optionalApi ' com.fasterxml.jackson.datatype:jackson-datatype-joda'
510
- optionalApi (' com.fasterxml.jackson.module:jackson-module-kotlin' ) {
529
+ optional ' com.fasterxml.jackson.core:jackson-databind'
530
+ optional ' com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
531
+ optional ' com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
532
+ optional ' com.fasterxml.jackson.datatype:jackson-datatype-joda'
533
+ optional (' com.fasterxml.jackson.module:jackson-module-kotlin' ) {
511
534
exclude group : ' org.jetbrains.kotlin'
512
535
}
513
- optionalApi " com.google.protobuf:protobuf-java:$protobufVersion "
514
- optionalApi " com.jayway.jsonpath:json-path:$jsonpathVersion "
515
- optionalApi " com.esotericsoftware:kryo:$kryoVersion "
516
- optionalApi ' io.micrometer:micrometer-core'
517
- optionalApi (' io.micrometer:micrometer-tracing' ) {
536
+ optional " com.google.protobuf:protobuf-java:$protobufVersion "
537
+ optional " com.jayway.jsonpath:json-path:$jsonpathVersion "
538
+ optional " com.esotericsoftware:kryo:$kryoVersion "
539
+ optional ' io.micrometer:micrometer-core'
540
+ optional (' io.micrometer:micrometer-tracing' ) {
518
541
exclude group : ' aopalliance'
519
542
}
520
- optionalApi " io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion "
521
- optionalApi " org.apache.avro:avro:$avroVersion "
522
- optionalApi ' org.jetbrains.kotlinx:kotlinx-coroutines-reactor'
543
+ optional " io.github.resilience4j:resilience4j-ratelimiter:$resilience4jVersion "
544
+ optional " org.apache.avro:avro:$avroVersion "
545
+ optional ' org.jetbrains.kotlinx:kotlinx-coroutines-reactor'
523
546
524
547
testImplementation " com.google.protobuf:protobuf-java-util:$protobufVersion "
525
548
testImplementation " org.aspectj:aspectjweaver:$aspectjVersion "
@@ -532,7 +555,7 @@ project('spring-integration-core') {
532
555
}
533
556
534
557
dokkaHtmlPartial {
535
- outputDirectory. set(new File (buildDir , ' kdoc' ))
558
+ outputDirectory. set(new File (' build ' , ' kdoc' ))
536
559
dokkaSourceSets {
537
560
main {
538
561
sourceRoots. setFrom(file(' src/main/kotlin' ))
@@ -600,7 +623,7 @@ project('spring-integration-ftp') {
600
623
api project(' :spring-integration-file' )
601
624
api " commons-net:commons-net:$commonsNetVersion "
602
625
api ' org.springframework:spring-context-support'
603
- optionalApi " org.apache.ftpserver:ftpserver-core:$ftpServerVersion "
626
+ optional " org.apache.ftpserver:ftpserver-core:$ftpServerVersion "
604
627
605
628
testImplementation project(' :spring-integration-file' ). sourceSets. test. output
606
629
}
@@ -659,9 +682,9 @@ project('spring-integration-http') {
659
682
description = ' Spring Integration HTTP Support'
660
683
dependencies {
661
684
api ' org.springframework:spring-webmvc'
662
- providedImplementation " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
663
- optionalApi " com.rometools:rome:$romeToolsVersion "
664
- optionalApi ' org.springframework:spring-webflux'
685
+ provided " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
686
+ optional " com.rometools:rome:$romeToolsVersion "
687
+ optional ' org.springframework:spring-webflux'
665
688
666
689
testImplementation " org.hamcrest:hamcrest-core:$hamcrestVersion "
667
690
testImplementation ' org.springframework.security:spring-security-messaging'
@@ -693,7 +716,7 @@ project('spring-integration-jdbc') {
693
716
description = ' Spring Integration JDBC Support'
694
717
dependencies {
695
718
api ' org.springframework:spring-jdbc'
696
- optionalApi " org.postgresql:postgresql:$postgresVersion "
719
+ optional " org.postgresql:postgresql:$postgresVersion "
697
720
698
721
testImplementation " com.h2database:h2:$h2Version "
699
722
testImplementation " org.hsqldb:hsqldb:$hsqldbVersion "
@@ -718,7 +741,7 @@ project('spring-integration-jms') {
718
741
description = ' Spring Integration JMS Support'
719
742
dependencies {
720
743
api ' org.springframework:spring-jms'
721
- providedImplementation " jakarta.jms:jakarta.jms-api:$jmsApiVersion "
744
+ provided " jakarta.jms:jakarta.jms-api:$jmsApiVersion "
722
745
723
746
testImplementation(" org.apache.activemq:artemis-server:$artemisVersion " ) {
724
747
exclude group : ' org.jboss.logmanager'
@@ -741,7 +764,7 @@ project('spring-integration-jpa') {
741
764
description = ' Spring Integration JPA Support'
742
765
dependencies {
743
766
api ' org.springframework:spring-orm'
744
- optionalApi " jakarta.persistence:jakarta.persistence-api:$jpaApiVersion "
767
+ optional " jakarta.persistence:jakarta.persistence-api:$jpaApiVersion "
745
768
746
769
testImplementation ' org.springframework.data:spring-data-jpa'
747
770
testImplementation " com.h2database:h2:$h2Version "
@@ -764,7 +787,7 @@ project('spring-integration-mail') {
764
787
dependencies {
765
788
api ' org.springframework:spring-context-support'
766
789
767
- providedImplementation " org.eclipse.angus:jakarta.mail:$mailVersion "
790
+ provided " org.eclipse.angus:jakarta.mail:$mailVersion "
768
791
769
792
testImplementation " com.icegreen:greenmail:$greenmailVersion "
770
793
@@ -777,8 +800,8 @@ project('spring-integration-mongodb') {
777
800
dependencies {
778
801
api ' org.springframework.data:spring-data-mongodb'
779
802
780
- optionalApi " org.mongodb:mongodb-driver-sync:$mongoDriverVersion "
781
- optionalApi " org.mongodb:mongodb-driver-reactivestreams:$mongoDriverVersion "
803
+ optional " org.mongodb:mongodb-driver-sync:$mongoDriverVersion "
804
+ optional " org.mongodb:mongodb-driver-reactivestreams:$mongoDriverVersion "
782
805
783
806
testImplementation ' org.testcontainers:mongodb'
784
807
}
@@ -799,7 +822,7 @@ project('spring-integration-mqtt') {
799
822
dependencies {
800
823
api " org.eclipse.paho:org.eclipse.paho.client.mqttv3:$pahoMqttClientVersion "
801
824
802
- optionalApi " org.eclipse.paho:org.eclipse.paho.mqttv5.client:$pahoMqttClientVersion "
825
+ optional " org.eclipse.paho:org.eclipse.paho.mqttv5.client:$pahoMqttClientVersion "
803
826
804
827
testImplementation project(' :spring-integration-jmx' )
805
828
testImplementation ' com.fasterxml.jackson.core:jackson-databind'
@@ -829,9 +852,9 @@ project('spring-integration-rsocket') {
829
852
project(' spring-integration-scripting' ) {
830
853
description = ' Spring Integration Scripting Support'
831
854
dependencies {
832
- optionalApi ' org.jetbrains.kotlin:kotlin-scripting-jsr223'
833
- providedImplementation " org.graalvm.sdk:graal-sdk:$graalvmVersion "
834
- providedImplementation " org.graalvm.js:js:$graalvmVersion "
855
+ optional ' org.jetbrains.kotlin:kotlin-scripting-jsr223'
856
+ provided " org.graalvm.sdk:graal-sdk:$graalvmVersion "
857
+ provided " org.graalvm.js:js:$graalvmVersion "
835
858
836
859
testImplementation " org.jruby:jruby-complete:$jrubyVersion "
837
860
testImplementation ' org.apache.groovy:groovy-jsr223'
@@ -882,7 +905,7 @@ project('spring-integration-smb') {
882
905
project(' spring-integration-stomp' ) {
883
906
description = ' Spring Integration STOMP Support'
884
907
dependencies {
885
- optionalApi ' org.springframework:spring-websocket'
908
+ optional ' org.springframework:spring-websocket'
886
909
887
910
testImplementation project(' :spring-integration-websocket' )
888
911
testImplementation project(' :spring-integration-websocket' ). sourceSets. test. output
@@ -934,7 +957,7 @@ project('spring-integration-webflux') {
934
957
exclude group : ' org.springframework' , module : ' spring-webmvc'
935
958
}
936
959
api ' org.springframework:spring-webflux'
937
- optionalApi ' io.projectreactor.netty:reactor-netty-http'
960
+ optional ' io.projectreactor.netty:reactor-netty-http'
938
961
939
962
testImplementation " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
940
963
testImplementation " org.hamcrest:hamcrest-core:$hamcrestVersion "
@@ -957,8 +980,8 @@ project('spring-integration-websocket') {
957
980
description = ' Spring Integration WebSockets Support'
958
981
dependencies {
959
982
api ' org.springframework:spring-websocket'
960
- optionalApi ' org.springframework:spring-webmvc'
961
- providedImplementation " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
983
+ optional ' org.springframework:spring-webmvc'
984
+ provided " jakarta.servlet:jakarta.servlet-api:$servletApiVersion "
962
985
963
986
testImplementation project(' :spring-integration-event' )
964
987
testImplementation " org.apache.tomcat.embed:tomcat-embed-websocket:$tomcatVersion "
@@ -983,7 +1006,7 @@ project('spring-integration-ws') {
983
1006
exclude group : ' org.glassfish.jaxb'
984
1007
}
985
1008
986
- providedImplementation " com.sun.xml.bind:jaxb-impl:$jaxbVersion "
1009
+ provided " com.sun.xml.bind:jaxb-impl:$jaxbVersion "
987
1010
988
1011
testImplementation " com.thoughtworks.xstream:xstream:$xstreamVersion "
989
1012
testImplementation(' org.springframework.ws:spring-ws-support' ) {
@@ -1004,7 +1027,7 @@ project('spring-integration-xml') {
1004
1027
api(' org.springframework.ws:spring-xml' ) {
1005
1028
exclude group : ' org.springframework'
1006
1029
}
1007
- optionalApi (' org.springframework.ws:spring-ws-core' ) {
1030
+ optional (' org.springframework.ws:spring-ws-core' ) {
1008
1031
exclude group : ' org.springframework'
1009
1032
}
1010
1033
@@ -1034,7 +1057,7 @@ project('spring-integration-zeromq') {
1034
1057
dependencies {
1035
1058
api " org.zeromq:jeromq:$jeroMqVersion "
1036
1059
1037
- optionalApi ' com.fasterxml.jackson.core:jackson-databind'
1060
+ optional ' com.fasterxml.jackson.core:jackson-databind'
1038
1061
}
1039
1062
}
1040
1063
@@ -1098,10 +1121,9 @@ tasks.register('api', Javadoc) {
1098
1121
source javaProjects. collect { project ->
1099
1122
project. sourceSets. main. allJava
1100
1123
}
1101
- destinationDir = new File (buildDir, ' api' )
1102
- classpath = files(javaProjects. collect { project ->
1103
- project. sourceSets. main. compileClasspath
1104
- })
1124
+ destinationDir = new File (' build' , ' api' )
1125
+ classpath = files(). from { files(javaProjects. collect { it. sourceSets. main. compileClasspath }) }
1126
+
1105
1127
}
1106
1128
1107
1129
dokkaHtmlMultiModule {
0 commit comments