From e870ef722937448bc03d4733050e0e66a006ed48 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 16 Dec 2024 11:30:27 +0000 Subject: [PATCH] Address another deprecation warning in report take See gh-400 --- .../internal/report/DependencyManagementReportTask.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/spring/gradle/dependencymanagement/internal/report/DependencyManagementReportTask.java b/src/main/java/io/spring/gradle/dependencymanagement/internal/report/DependencyManagementReportTask.java index 3728646..343dfb7 100644 --- a/src/main/java/io/spring/gradle/dependencymanagement/internal/report/DependencyManagementReportTask.java +++ b/src/main/java/io/spring/gradle/dependencymanagement/internal/report/DependencyManagementReportTask.java @@ -25,6 +25,7 @@ import org.gradle.api.DefaultTask; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; +import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.tasks.TaskAction; /** @@ -44,11 +45,14 @@ public class DependencyManagementReportTask extends DefaultTask { private final boolean rootProject; + private final ConfigurationContainer configurationContainer; + public DependencyManagementReportTask() { Project project = getProject(); this.projectPath = project.getPath(); this.projectDescription = project.getDescription(); this.rootProject = project.getRootProject().equals(project); + this.configurationContainer = project.getConfigurations(); } void setRenderer(DependencyManagementReportRenderer renderer) { @@ -73,7 +77,7 @@ public void report() { .getManagedVersionsForConfiguration(null); this.renderer.renderGlobalManagedVersions(globalManagedVersions); Set configurations = new TreeSet<>(Comparator.comparing(Configuration::getName)); - configurations.addAll(getProject().getConfigurations()); + configurations.addAll(this.configurationContainer); for (Configuration configuration : configurations) { Map managedVersions = this.dependencyManagementContainer .getManagedVersionsForConfiguration(configuration);