|
32 | 32 | import org.gradle.api.DefaultTask;
|
33 | 33 | import org.gradle.api.GradleException;
|
34 | 34 | import org.gradle.api.artifacts.ConfigurationContainer;
|
| 35 | +import org.gradle.api.artifacts.ResolvedArtifact; |
35 | 36 | import org.gradle.api.artifacts.dsl.DependencyHandler;
|
36 | 37 | import org.gradle.api.tasks.TaskAction;
|
37 | 38 |
|
|
46 | 47 | * Checks the validity of a bom.
|
47 | 48 | *
|
48 | 49 | * @author Andy Wilkinson
|
| 50 | + * @author Wick Dynex |
49 | 51 | */
|
50 | 52 | public abstract class CheckBom extends DefaultTask {
|
51 | 53 |
|
@@ -209,14 +211,15 @@ private void checkDependencyManagementAlignment(Library library, List<String> er
|
209 | 211 |
|
210 | 212 | private File resolveBom(Library library, String alignsWithBom) {
|
211 | 213 | String coordinates = alignsWithBom + ":" + library.getVersion().getVersion() + "@pom";
|
212 |
| - Set<File> files = this.configurations.detachedConfiguration(this.dependencies.create(coordinates)) |
| 214 | + Set<ResolvedArtifact> artifacts = this.configurations |
| 215 | + .detachedConfiguration(this.dependencies.create(coordinates)) |
213 | 216 | .getResolvedConfiguration()
|
214 |
| - .getFiles(); |
215 |
| - if (files.size() != 1) { |
216 |
| - throw new IllegalStateException( |
217 |
| - "Expected a single file but '" + coordinates + "' resolved to " + files.size()); |
| 217 | + .getResolvedArtifacts(); |
| 218 | + if (artifacts.size() != 1) { |
| 219 | + throw new IllegalStateException("Expected a single file but '%s' resolved to %d artifacts" |
| 220 | + .formatted(coordinates, artifacts.size())); |
218 | 221 | }
|
219 |
| - return files.iterator().next(); |
| 222 | + return artifacts.iterator().next().getFile(); |
220 | 223 | }
|
221 | 224 |
|
222 | 225 | }
|
0 commit comments