Fix Gradle deprecations
* Use `optional` configuration with variants instead of `feature` * Use `io.freefair.aggregate-javadoc` * Upgrade to Gradle `8.9` * Some other minor ode clean in Gradle configs **Auto-cherry-pick to `3.2.x` & `3.1.x`**
This commit is contained in:
117
build.gradle
117
build.gradle
@@ -2,9 +2,8 @@ buildscript {
|
||||
ext.kotlinVersion = '1.9.25'
|
||||
ext.isCI = System.getenv('GITHUB_ACTION')
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url 'https://repo.spring.io/plugins-release-local' }
|
||||
mavenCentral()
|
||||
if (version.endsWith('SNAPSHOT')) {
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
}
|
||||
@@ -17,12 +16,12 @@ buildscript {
|
||||
|
||||
plugins {
|
||||
id 'base'
|
||||
id 'project-report'
|
||||
id 'idea'
|
||||
id 'org.ajoberstar.grgit' version '5.2.2'
|
||||
id 'io.spring.nohttp' version '0.0.11'
|
||||
id 'io.spring.dependency-management' version '1.1.6' apply false
|
||||
id 'com.github.spotbugs' version '6.0.19'
|
||||
id 'io.freefair.aggregate-javadoc' version '8.6'
|
||||
}
|
||||
|
||||
apply plugin: 'io.spring.nohttp'
|
||||
@@ -122,29 +121,44 @@ allprojects {
|
||||
|
||||
configure(javaProjects) { subproject ->
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'java'
|
||||
apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'kotlin-spring'
|
||||
|
||||
apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
|
||||
|
||||
def scopeAttribute = Attribute.of('dependency.scope', String)
|
||||
|
||||
configurations {
|
||||
optional {
|
||||
attributes {
|
||||
attribute(scopeAttribute, 'optional')
|
||||
}
|
||||
}
|
||||
|
||||
compileClasspath.extendsFrom(optional)
|
||||
testCompileClasspath.extendsFrom(optional)
|
||||
testRuntimeClasspath.extendsFrom(optional)
|
||||
}
|
||||
|
||||
components.java.addVariantsFromConfiguration(configurations.optional) {
|
||||
mapToOptional()
|
||||
}
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
registerFeature('optional') {
|
||||
usingSourceSet(sourceSets.main)
|
||||
}
|
||||
}
|
||||
|
||||
compileJava {
|
||||
sourceCompatibility = 17
|
||||
targetCompatibility = 17
|
||||
options.release = 17
|
||||
}
|
||||
|
||||
compileTestJava {
|
||||
sourceCompatibility = 17
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
@@ -152,6 +166,10 @@ configure(javaProjects) { subproject ->
|
||||
|
||||
// dependencies that are common across all java projects
|
||||
dependencies {
|
||||
attributesSchema {
|
||||
attribute(scopeAttribute)
|
||||
}
|
||||
|
||||
def spotbugsAnnotations = "com.github.spotbugs:spotbugs-annotations:${spotbugs.toolVersion.get()}"
|
||||
compileOnly spotbugsAnnotations
|
||||
testCompileOnly spotbugsAnnotations
|
||||
@@ -171,7 +189,7 @@ configure(javaProjects) { subproject ->
|
||||
exclude group: 'org.hamcrest'
|
||||
}
|
||||
testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion"
|
||||
optionalApi "org.assertj:assertj-core:$assertjVersion"
|
||||
optional "org.assertj:assertj-core:$assertjVersion"
|
||||
}
|
||||
|
||||
// enable all compiler warnings; individual projects may customize further
|
||||
@@ -188,7 +206,6 @@ configure(javaProjects) { subproject ->
|
||||
|
||||
maxHeapSize = '1536m'
|
||||
useJUnitPlatform()
|
||||
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
@@ -205,7 +222,7 @@ configure(javaProjects) { subproject ->
|
||||
}
|
||||
}
|
||||
|
||||
task updateCopyrights {
|
||||
tasks.register('updateCopyrights') {
|
||||
onlyIf { !isCI }
|
||||
inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) })
|
||||
outputs.dir('build/classes')
|
||||
@@ -278,29 +295,29 @@ project ('spring-kafka') {
|
||||
exclude group: 'org.springframework'
|
||||
}
|
||||
api "org.apache.kafka:kafka-clients:$kafkaVersion"
|
||||
optionalApi "org.apache.kafka:kafka-streams:$kafkaVersion"
|
||||
optionalApi "org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinCoroutinesVersion"
|
||||
optionalApi 'com.fasterxml.jackson.core:jackson-core'
|
||||
optionalApi 'com.fasterxml.jackson.core:jackson-databind'
|
||||
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
|
||||
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
|
||||
optionalApi 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
|
||||
optionalApi ('com.fasterxml.jackson.module:jackson-module-kotlin') {
|
||||
api 'io.micrometer:micrometer-observation'
|
||||
optional "org.apache.kafka:kafka-streams:$kafkaVersion"
|
||||
optional "org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinCoroutinesVersion"
|
||||
optional 'com.fasterxml.jackson.core:jackson-core'
|
||||
optional 'com.fasterxml.jackson.core:jackson-databind'
|
||||
optional 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
|
||||
optional 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
|
||||
optional 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
|
||||
optional ('com.fasterxml.jackson.module:jackson-module-kotlin') {
|
||||
exclude group: 'org.jetbrains.kotlin'
|
||||
}
|
||||
|
||||
// Spring Data projection message binding support
|
||||
optionalApi ("org.springframework.data:spring-data-commons") {
|
||||
optional ("org.springframework.data:spring-data-commons") {
|
||||
exclude group: 'org.springframework'
|
||||
exclude group: 'io.micrometer'
|
||||
}
|
||||
optionalApi "com.jayway.jsonpath:json-path:$jaywayJsonPathVersion"
|
||||
optional "com.jayway.jsonpath:json-path:$jaywayJsonPathVersion"
|
||||
|
||||
optionalApi 'io.projectreactor:reactor-core'
|
||||
optionalApi 'io.projectreactor.kafka:reactor-kafka'
|
||||
optionalApi 'io.micrometer:micrometer-core'
|
||||
api 'io.micrometer:micrometer-observation'
|
||||
optionalApi 'io.micrometer:micrometer-tracing'
|
||||
optional 'io.projectreactor:reactor-core'
|
||||
optional 'io.projectreactor.kafka:reactor-kafka'
|
||||
optional 'io.micrometer:micrometer-core'
|
||||
optional 'io.micrometer:micrometer-tracing'
|
||||
|
||||
testImplementation project (':spring-kafka-test')
|
||||
testImplementation 'io.projectreactor:reactor-test'
|
||||
@@ -326,9 +343,7 @@ project('spring-kafka-bom') {
|
||||
dependencies {
|
||||
constraints {
|
||||
javaProjects.sort { "$it.name" }.each {
|
||||
if (it.name != 'spring-kafka-docs') {
|
||||
api it
|
||||
}
|
||||
api it
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -369,12 +384,12 @@ project ('spring-kafka-test') {
|
||||
}
|
||||
api 'org.junit.jupiter:junit-jupiter-api'
|
||||
api 'org.junit.platform:junit-platform-launcher'
|
||||
optionalApi "org.hamcrest:hamcrest-core:$hamcrestVersion"
|
||||
optionalApi "org.mockito:mockito-core:$mockitoVersion"
|
||||
optionalApi ("junit:junit:$junit4Version") {
|
||||
optional "org.hamcrest:hamcrest-core:$hamcrestVersion"
|
||||
optional "org.mockito:mockito-core:$mockitoVersion"
|
||||
optional ("junit:junit:$junit4Version") {
|
||||
exclude group: 'org.hamcrest', module: 'hamcrest-core'
|
||||
}
|
||||
optionalApi "org.apache.logging.log4j:log4j-core:$log4jVersion"
|
||||
optional "org.apache.logging.log4j:log4j-core:$log4jVersion"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,15 +421,19 @@ tasks.register('filterMetricsDocsContent', Copy) {
|
||||
filter { line -> line.replaceAll('org.springframework.kafka.support.micrometer.', '').replaceAll('^Fully qualified n', 'N') }
|
||||
}
|
||||
|
||||
tasks.register('api', Javadoc) {
|
||||
group = 'Documentation'
|
||||
description = 'Generates aggregated Javadoc API documentation.'
|
||||
dependencies {
|
||||
javaProjects.each {
|
||||
javadoc it
|
||||
}
|
||||
}
|
||||
|
||||
javadoc {
|
||||
title = "${rootProject.description} ${version} API"
|
||||
options {
|
||||
encoding = 'UTF-8'
|
||||
memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
|
||||
memberLevel = JavadocMemberLevel.PROTECTED
|
||||
author = true
|
||||
header = rootProject.description
|
||||
header = project.description
|
||||
use = true
|
||||
overview = 'src/api/overview.html'
|
||||
splitIndex = true
|
||||
@@ -422,14 +441,14 @@ tasks.register('api', Javadoc) {
|
||||
addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint
|
||||
}
|
||||
|
||||
source javaProjects.collect { project ->
|
||||
project.sourceSets.main.allJava
|
||||
}
|
||||
|
||||
classpath = files(javaProjects.collect { project ->
|
||||
project.sourceSets.main.compileClasspath
|
||||
})
|
||||
destinationDir = file('build/api')
|
||||
classpath = files().from { files(javaProjects.collect { it.sourceSets.main.compileClasspath }) }
|
||||
}
|
||||
|
||||
tasks.register('api') {
|
||||
group = 'Documentation'
|
||||
description = 'Generates aggregated Javadoc API documentation.'
|
||||
dependsOn javadoc
|
||||
}
|
||||
|
||||
tasks.register('docsZip', Zip) {
|
||||
@@ -442,7 +461,7 @@ tasks.register('docsZip', Zip) {
|
||||
include 'changelog.txt'
|
||||
}
|
||||
|
||||
from(api) {
|
||||
from(javadoc) {
|
||||
into 'api'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,37 @@
|
||||
node {
|
||||
version = '16.16.0'
|
||||
}
|
||||
|
||||
antora {
|
||||
version = '3.2.0-alpha.2'
|
||||
playbook = file('src/main/antora/antora-playbook.yml')
|
||||
options = ['to-dir' : project.layout.buildDirectory.dir('site').get().toString(), clean: true, fetch: !project.gradle.startParameter.offline, stacktrace: true]
|
||||
options = [
|
||||
'to-dir' : project.layout.buildDirectory.dir('site').get().toString(),
|
||||
clean : true,
|
||||
fetch : !project.gradle.startParameter.offline,
|
||||
stacktrace: true
|
||||
]
|
||||
dependencies = [
|
||||
'@antora/atlas-extension': '1.0.0-alpha.1',
|
||||
'@antora/collector-extension': '1.0.0-alpha.3',
|
||||
'@asciidoctor/tabs': '1.0.0-beta.3',
|
||||
'@springio/antora-extensions': '1.4.2',
|
||||
'@antora/atlas-extension' : '1.0.0-alpha.1',
|
||||
'@antora/collector-extension' : '1.0.0-alpha.3',
|
||||
'@asciidoctor/tabs' : '1.0.0-beta.3',
|
||||
'@springio/antora-extensions' : '1.4.2',
|
||||
'@springio/asciidoctor-extensions': '1.0.0-alpha.8',
|
||||
]
|
||||
}
|
||||
|
||||
tasks.named("generateAntoraYml") {
|
||||
asciidocAttributes = project.provider( {
|
||||
return ['project-version' : project.version,
|
||||
'revnumber': project.version,
|
||||
'spring-version': project.version,
|
||||
tasks.named('generateAntoraYml') {
|
||||
asciidocAttributes = project.provider({
|
||||
return ['project-version': project.version,
|
||||
'revnumber' : project.version,
|
||||
'spring-version' : project.version,
|
||||
]
|
||||
} )
|
||||
})
|
||||
baseAntoraYmlFile = file('src/main/antora/antora.yml')
|
||||
}
|
||||
|
||||
tasks.create(name: 'createAntoraPartials', type: Sync) {
|
||||
tasks.register('createAntoraPartials', Sync) {
|
||||
from { project.rootProject.tasks.filterMetricsDocsContent.outputs }
|
||||
into layout.buildDirectory.dir('generated-antora-resources/modules/ROOT/partials')
|
||||
}
|
||||
|
||||
tasks.create('generateAntoraResources') {
|
||||
tasks.register('generateAntoraResources') {
|
||||
dependsOn 'createAntoraPartials'
|
||||
dependsOn 'generateAntoraYml'
|
||||
}
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
7
gradlew
vendored
7
gradlew
vendored
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -84,7 +86,8 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
22
gradlew.bat
vendored
22
gradlew.bat
vendored
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
||||
Reference in New Issue
Block a user