diff --git a/buildSrc/src/main/java/org/springframework/security/convention/versions/VerifyDependenciesVersionsPlugin.java b/buildSrc/src/main/java/org/springframework/security/convention/versions/VerifyDependenciesVersionsPlugin.java index 62ee449d03..c34dfb7f56 100644 --- a/buildSrc/src/main/java/org/springframework/security/convention/versions/VerifyDependenciesVersionsPlugin.java +++ b/buildSrc/src/main/java/org/springframework/security/convention/versions/VerifyDependenciesVersionsPlugin.java @@ -19,13 +19,13 @@ package org.springframework.security.convention.versions; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; import org.gradle.api.DefaultTask; import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; -import org.gradle.api.artifacts.ModuleVersionIdentifier; import org.gradle.api.plugins.JavaBasePlugin; import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.TaskProvider; @@ -90,13 +90,18 @@ public class VerifyDependenciesVersionsPlugin implements Plugin { } private Map> getDependencies(List configurations) { - return configurations.stream().flatMap((configuration) -> { - return configuration.getResolvedConfiguration().getLenientConfiguration().getArtifacts().stream() + return configurations.stream() + .flatMap((configuration) -> { + return configuration.getIncoming().getResolutionResult().getAllDependencies().stream() .map((dep) -> { - ModuleVersionIdentifier id = dep.getModuleVersion().getId(); - return new Artifact(id.getName(), id.getVersion(), configuration.toString()); + String[] nameParts = dep.getRequested().getDisplayName().split(":"); + if (nameParts.length > 2) { + return new Artifact(nameParts[1], nameParts[2], configuration.toString()); + } + return null; }); }) + .filter(Objects::nonNull) .distinct() .collect(Collectors.groupingBy(Artifact::name)); }