Skip to content

Commit 659b30d

Browse files
wickdynexmhalbritter
authored andcommitted
Remove deprecated getFiles() instead of getResolvedArtifacts()
See gh-43191
1 parent 8f1a63d commit 659b30d

File tree

1 file changed

+12
-7
lines changed
  • buildSrc/src/main/java/org/springframework/boot/build/bom

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.gradle.api.DefaultTask;
3333
import org.gradle.api.GradleException;
3434
import org.gradle.api.artifacts.ConfigurationContainer;
35+
import org.gradle.api.artifacts.ResolvedArtifact;
3536
import org.gradle.api.artifacts.dsl.DependencyHandler;
3637
import org.gradle.api.tasks.TaskAction;
3738

@@ -46,6 +47,7 @@
4647
* Checks the validity of a bom.
4748
*
4849
* @author Andy Wilkinson
50+
* @author Wick Dynex
4951
*/
5052
public abstract class CheckBom extends DefaultTask {
5153

@@ -209,14 +211,17 @@ private void checkDependencyManagementAlignment(Library library, List<String> er
209211

210212
private File resolveBom(Library library, String alignsWithBom) {
211213
String coordinates = alignsWithBom + ":" + library.getVersion().getVersion() + "@pom";
212-
Set<File> files = this.configurations.detachedConfiguration(this.dependencies.create(coordinates))
213-
.getResolvedConfiguration()
214-
.getFiles();
215-
if (files.size() != 1) {
214+
215+
Set<ResolvedArtifact> artifacts = this.configurations
216+
.detachedConfiguration(this.dependencies.create(coordinates))
217+
.getResolvedConfiguration()
218+
.getResolvedArtifacts();
219+
220+
if (artifacts.size() != 1) {
216221
throw new IllegalStateException(
217-
"Expected a single file but '" + coordinates + "' resolved to " + files.size());
222+
"Expected a single file but '" + coordinates + "' resolved to " + artifacts.size());
218223
}
219-
return files.iterator().next();
220-
}
221224

225+
return artifacts.iterator().next().getFile();
226+
}
222227
}

0 commit comments

Comments
 (0)