|
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,17 @@ 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)) |
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) { |
216 | 221 | 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()); |
218 | 223 | }
|
219 |
| - return files.iterator().next(); |
220 |
| - } |
221 | 224 |
|
| 225 | + return artifacts.iterator().next().getFile(); |
| 226 | + } |
222 | 227 | }
|
0 commit comments