Avoid Gradle deprecation warnings

After the upgrade to Gradle 9.6.0/9.6.1, the Gradle build started
emitting warnings due to use of deprecated APIs.

For example, Project.getProperties() is now annotated as @⁠Deprecated
in Gradle 9.6 and will be removed in Gradle 10.0.

To avoid the warnings, this commit modifies:

- TestConventions to use `project.findProperty(...)` instead of
  `project.getProperties().get(...)`

- framework-api.gradle to use `rootProject.ext.moduleProjects` instead
  of simply `moduleProjects`

- framework-api.gradle and framework-bom.gradle to use
  `project(<projectX>)` instead of simply `<projectX>`

- ide.gradle so that it no longer uses the deprecated `javaRuntimeName`

See gh-36952
This commit is contained in:
Sam Brannen
2026-06-27 17:02:40 +02:00
parent ade96d275d
commit 66ffc04fe5
4 changed files with 7 additions and 8 deletions
@@ -71,7 +71,7 @@ class TestConventions {
"junit.platform.discovery.issue.severity.critical", "INFO" "junit.platform.discovery.issue.severity.critical", "INFO"
)); ));
if (project.hasProperty("testGroups")) { if (project.hasProperty("testGroups")) {
test.systemProperty("testGroups", project.getProperties().get("testGroups")); test.systemProperty("testGroups", project.findProperty("testGroups"));
} }
test.jvmArgs( test.jvmArgs(
"--add-opens=java.base/java.lang=ALL-UNNAMED", "--add-opens=java.base/java.lang=ALL-UNNAMED",
@@ -82,7 +82,7 @@ class TestConventions {
private void configureByteBuddyAgent(Project project) { private void configureByteBuddyAgent(Project project) {
if (project.hasProperty("byteBuddyVersion")) { if (project.hasProperty("byteBuddyVersion")) {
String byteBuddyVersion = (String) project.getProperties().get("byteBuddyVersion"); String byteBuddyVersion = (String) project.findProperty("byteBuddyVersion");
Configuration byteBuddyAgentConfig = project.getConfigurations().create("byteBuddyAgentConfig"); Configuration byteBuddyAgentConfig = project.getConfigurations().create("byteBuddyAgentConfig");
byteBuddyAgentConfig.setTransitive(false); byteBuddyAgentConfig.setTransitive(false);
Dependency byteBuddyAgent = project.getDependencies().create("net.bytebuddy:byte-buddy-agent:" + byteBuddyVersion); Dependency byteBuddyAgent = project.getDependencies().create("net.bytebuddy:byte-buddy-agent:" + byteBuddyVersion);
+4 -4
View File
@@ -15,8 +15,8 @@ repositories {
} }
dependencies { dependencies {
moduleProjects.each { moduleProject -> rootProject.ext.moduleProjects.each { moduleProject ->
javadoc moduleProject javadoc project(moduleProject.path)
} }
} }
@@ -52,7 +52,7 @@ javadoc {
// ensure the javadoc process can resolve types compiled from .aj sources // ensure the javadoc process can resolve types compiled from .aj sources
springAspectsOutput springAspectsOutput
) )
classpath += files(moduleProjects.collect { it.sourceSets.main.compileClasspath }) classpath += files(rootProject.ext.moduleProjects.collect { it.sourceSets.main.compileClasspath })
} }
} }
@@ -96,7 +96,7 @@ tasks.register('schemaZip', Zip) {
description = "Builds -${archiveClassifier} archive containing all " + description = "Builds -${archiveClassifier} archive containing all " +
"XSDs for deployment at https://springframework.org/schema." "XSDs for deployment at https://springframework.org/schema."
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
moduleProjects.each { module -> rootProject.ext.moduleProjects.each { module ->
def Properties schemas = new Properties(); def Properties schemas = new Properties();
module.sourceSets.main.resources.find { module.sourceSets.main.resources.find {
+1 -1
View File
@@ -8,7 +8,7 @@ group = "org.springframework"
dependencies { dependencies {
constraints { constraints {
parent.moduleProjects.sort { "$it.name" }.each { parent.moduleProjects.sort { "$it.name" }.each {
api it api project(it.path)
} }
} }
} }
-1
View File
@@ -7,7 +7,6 @@ apply plugin: 'eclipse'
eclipse.jdt { eclipse.jdt {
sourceCompatibility = 17 sourceCompatibility = 17
targetCompatibility = 17 targetCompatibility = 17
javaRuntimeName = "JavaSE-17"
} }
// Replace classpath entries with project dependencies (GRADLE-1116) // Replace classpath entries with project dependencies (GRADLE-1116)