Remove deprecated getFiles() instead of getResolvedArtifacts()
See gh-43191
This commit is contained in:
parent
8f1a63d293
commit
659b30d9bb
|
|
@ -32,6 +32,7 @@ import org.apache.maven.artifact.versioning.VersionRange;
|
||||||
import org.gradle.api.DefaultTask;
|
import org.gradle.api.DefaultTask;
|
||||||
import org.gradle.api.GradleException;
|
import org.gradle.api.GradleException;
|
||||||
import org.gradle.api.artifacts.ConfigurationContainer;
|
import org.gradle.api.artifacts.ConfigurationContainer;
|
||||||
|
import org.gradle.api.artifacts.ResolvedArtifact;
|
||||||
import org.gradle.api.artifacts.dsl.DependencyHandler;
|
import org.gradle.api.artifacts.dsl.DependencyHandler;
|
||||||
import org.gradle.api.tasks.TaskAction;
|
import org.gradle.api.tasks.TaskAction;
|
||||||
|
|
||||||
|
|
@ -46,6 +47,7 @@ import org.springframework.boot.build.bom.bomr.version.DependencyVersion;
|
||||||
* Checks the validity of a bom.
|
* Checks the validity of a bom.
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
|
* @author Wick Dynex
|
||||||
*/
|
*/
|
||||||
public abstract class CheckBom extends DefaultTask {
|
public abstract class CheckBom extends DefaultTask {
|
||||||
|
|
||||||
|
|
@ -209,14 +211,17 @@ 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<File> files = this.configurations.detachedConfiguration(this.dependencies.create(coordinates))
|
|
||||||
|
Set<ResolvedArtifact> artifacts = this.configurations
|
||||||
|
.detachedConfiguration(this.dependencies.create(coordinates))
|
||||||
.getResolvedConfiguration()
|
.getResolvedConfiguration()
|
||||||
.getFiles();
|
.getResolvedArtifacts();
|
||||||
if (files.size() != 1) {
|
|
||||||
|
if (artifacts.size() != 1) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Expected a single file but '" + coordinates + "' resolved to " + files.size());
|
"Expected a single file but '" + coordinates + "' resolved to " + artifacts.size());
|
||||||
}
|
|
||||||
return files.iterator().next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return artifacts.iterator().next().getFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue