Browse Source

Polish "Remove deprecated getFiles() instead of getResolvedArtifacts()"

See gh-43191
3.2.x
Moritz Halbritter 1 year ago
parent
commit
df35d44ea7
  1. 14
      buildSrc/src/main/java/org/springframework/boot/build/bom/CheckBom.java

14
buildSrc/src/main/java/org/springframework/boot/build/bom/CheckBom.java

@ -211,17 +211,15 @@ public abstract class CheckBom extends DefaultTask {
private File resolveBom(Library library, String alignsWithBom) { private File resolveBom(Library library, String alignsWithBom) {
String coordinates = alignsWithBom + ":" + library.getVersion().getVersion() + "@pom"; String coordinates = alignsWithBom + ":" + library.getVersion().getVersion() + "@pom";
Set<ResolvedArtifact> artifacts = this.configurations Set<ResolvedArtifact> artifacts = this.configurations
.detachedConfiguration(this.dependencies.create(coordinates)) .detachedConfiguration(this.dependencies.create(coordinates))
.getResolvedConfiguration() .getResolvedConfiguration()
.getResolvedArtifacts(); .getResolvedArtifacts();
if (artifacts.size() != 1) { if (artifacts.size() != 1) {
throw new IllegalStateException( throw new IllegalStateException("Expected a single file but '%s' resolved to %d artifacts"
"Expected a single file but '" + coordinates + "' resolved to " + artifacts.size()); .formatted(coordinates, artifacts.size()));
} }
return artifacts.iterator().next().getFile(); return artifacts.iterator().next().getFile();
} }
} }

Loading…
Cancel
Save