11/*
2- * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved.
2+ * Copyright (c) 2011-2022 VMware Inc. or its affiliates, All Rights Reserved.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -21,40 +21,30 @@ buildscript {
2121 }
2222}
2323plugins {
24- id ' org. asciidoctor.jvm. convert' version ' 3.3.2 ' apply false
25- id ' org. asciidoctor.jvm. pdf' version ' 3.3.2 ' apply false
24+ alias(libs . plugins . asciidoctor. convert) apply false
25+ alias(libs . plugins . asciidoctor. pdf) apply false
2626 // applied in setup.gradle, only if artifactory credentials are configured
27- id " com.jfrog .artifactory" version " 4.24.20 " apply false
27+ alias(libs . plugins . artifactory) apply false
2828}
2929
3030ext {
31- gradleScriptDir = " ${ rootProject.projectDir } / gradle"
31+ // NOTE: all dependencies, including plugins, are defined in gradle/libs.versions.toml catalog
3232
33- // Logging
34- slf4jVersion = ' 1.7.32'
35- logbackVersion = ' 1.2.6'
36-
37- // Libraries
38- rabbitMqJavaClientVersion = ' 5.13.1'
39-
40- // Sample
41- springBootVersion = ' 2.5.6'
42- springAmqpVersion = ' 2.3.11'
43-
44- // Testing
45- mockitoVersion = ' 4.0.0'
46- junitPlatformVersion = ' 1.8.1'
47- junitJupiterVersion = ' 5.8.1'
48- assertjVersion = ' 3.21.0'
49-
50- javadocLinks = [" https://docs.oracle.com/javase/8/docs/api/" ,
51- " https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/" ,
52- " https://projectreactor.io/docs/core/release/api/" ,
53- " https://rabbitmq.github.io/rabbitmq-java-client/api/current/" ,] as String []
33+ jdk = JavaVersion . current(). majorVersion
34+ jdkJavadoc = " https://docs.oracle.com/javase/$jdk /docs/api/"
35+ if (JavaVersion . current(). isJava11Compatible()) {
36+ jdkJavadoc = " https://docs.oracle.com/en/java/javase/$jdk /docs/api/"
37+ }
38+ javadocLinks = [
39+ jdkJavadoc,
40+ " https://www.reactive-streams.org/reactive-streams-${ libs.versions.reactiveStreams.get()} -javadoc/" ,
41+ " https://projectreactor.io/docs/core/release/api/" ,
42+ " https://rabbitmq.github.io/rabbitmq-java-client/api/current/"
43+ ] as String []
5444}
5545
56- apply from : " $g radleScriptDir /asciidoc.gradle"
57- apply from : " $g radleScriptDir /releaser.gradle"
46+ apply from : " ${ rootDir } /gradle /asciidoc.gradle"
47+ apply from : " ${ rootDir } /gradle /releaser.gradle"
5848
5949configurations. all {
6050 // check for snapshot updates every time
@@ -72,10 +62,13 @@ configure(allprojects) { project ->
7262 apply plugin : ' eclipse'
7363 apply plugin : ' idea'
7464 apply plugin : ' java'
75- apply from : " $g radleScriptDir /setup.gradle"
65+ apply from : " ${ rootDir } /gradle /setup.gradle"
7666
7767 sourceCompatibility = targetCompatibility = 1.8
7868
69+ if (JavaVersion . current(). isJava8Compatible()) {
70+ compileTestJava. options. compilerArgs + = " -parameters"
71+ }
7972 [compileJava, compileTestJava]* . options* . compilerArgs = [" -Xlint:varargs" ,
8073 " -Xlint:cast" ,
8174 " -Xlint:classfile" ,
@@ -97,21 +90,25 @@ configure(allprojects) { project ->
9790 ]
9891
9992 dependencies {
100- implementation " io.projectreactor:reactor-core:$reactorCoreVersion "
101- implementation " com.rabbitmq:amqp-client:$rabbitMqJavaClientVersion "
93+ implementation libs. reactor. core
94+ implementation libs. rabbitmq. javaClient
95+
96+ // JSR-305 annotations
97+ compileOnly libs. jsr305
10298
10399 // Testing
104100 // JUnit Jupiter API and TestEngine implementation
105- testImplementation(" org.junit.jupiter:junit-jupiter-api:${ junitJupiterVersion} " )
106- testImplementation(" org.junit.jupiter:junit-jupiter-params:${ junitJupiterVersion} " )
107- testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:${ junitJupiterVersion} " )
108-
109- testImplementation " io.projectreactor:reactor-test:$reactorCoreVersion "
110- testImplementation " org.mockito:mockito-core:$mockitoVersion "
111- testImplementation " org.assertj:assertj-core:${ assertjVersion} "
112- testRuntimeOnly " org.slf4j:jcl-over-slf4j:$slf4jVersion "
113- testRuntimeOnly " org.slf4j:slf4j-api:$slf4jVersion "
114- testRuntimeOnly " ch.qos.logback:logback-classic:$logbackVersion "
101+ testImplementation platform(libs. junit. bom)
102+ testImplementation " org.junit.jupiter:junit-jupiter-api"
103+ testImplementation " org.junit.jupiter:junit-jupiter-params"
104+ testRuntimeOnly " org.junit.jupiter:junit-jupiter-engine"
105+
106+ testImplementation libs. reactor. test
107+ testImplementation libs. mockito
108+ testImplementation libs. assertj
109+ testRuntimeOnly libs. slf4j. api
110+ testRuntimeOnly libs. slf4j. jcl
111+ testRuntimeOnly libs. logback
115112 }
116113
117114 // force test runs even when there are no test changes
@@ -121,7 +118,7 @@ configure(allprojects) { project ->
121118configure(rootProject) {
122119 archivesBaseName = ' reactor-rabbitmq'
123120 description = ' Reactor RabbitMQ: A reactive API for RabbitMQ'
124- apply from : " $g radleScriptDir /javadoc.gradle"
121+ apply from : " ${ rootDir } /gradle /javadoc.gradle"
125122
126123 jar {
127124 manifest {
@@ -145,26 +142,27 @@ project(':reactor-rabbitmq-samples') {
145142
146143 dependencies {
147144 implementation rootProject
148- runtimeOnly " ch.qos.logback:logback-classic:$logbackVersion "
149- implementation " org.springframework.boot:spring-boot-starter:$springBootVersion "
150- implementation " org.springframework.amqp:spring-rabbit:$springAmqpVersion "
145+
146+ runtimeOnly libs. logback
147+ implementation libs. spring. boot. starter
148+ implementation libs. spring. amqp. rabbitmq
151149
152150 testImplementation rootProject. sourceSets. test. output
153- testRuntimeOnly " org.springframework .boot:spring-boot-starter- test: $s pringBootVersion "
151+ testRuntimeOnly libs . spring . boot. test
154152 }
155153
156154 task sender(type :JavaExec ) {
157- mainClass = ' reactor.rabbitmq.samples.SampleSender'
155+ mainClass. set( ' reactor.rabbitmq.samples.SampleSender' )
158156 classpath = sourceSets. main. runtimeClasspath
159157 }
160158
161159 task receiver(type :JavaExec ) {
162- mainClass = ' reactor.rabbitmq.samples.SampleReceiver'
160+ mainClass. set( ' reactor.rabbitmq.samples.SampleReceiver' )
163161 classpath = sourceSets. main. runtimeClasspath
164162 }
165163
166164 task springboot(type :JavaExec ) {
167- mainClass = ' reactor.rabbitmq.samples.SpringBootSample'
165+ mainClass. set( ' reactor.rabbitmq.samples.SpringBootSample' )
168166 classpath = sourceSets. main. runtimeClasspath
169167 }
170168
0 commit comments