2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-26 08:37:11 -07:00

Improve artifact not found exception to explicitly mention that no repositories or no artifact locations are defined.

This commit is contained in:
Geert Bevin 2024-05-22 12:25:02 -04:00
parent f0129e7ba1
commit 57c4b20de8

View file

@ -365,7 +365,16 @@ public class DependencyResolver {
} }
if (metadata == null) { if (metadata == null) {
throw new ArtifactNotFoundException(dependency_, artifacts.stream().map(RepositoryArtifact::location).collect(Collectors.joining(", "))); var location = artifacts.stream().map(RepositoryArtifact::location).collect(Collectors.joining(", "));
if (location.isEmpty()) {
if (repositories_.isEmpty()) {
location = "[no repositories defined]";
}
else {
location = "[no metadata locations defined]";
}
}
throw new ArtifactNotFoundException(dependency_, location);
} }
var xml = new Xml2MavenMetadata(); var xml = new Xml2MavenMetadata();
@ -414,7 +423,16 @@ public class DependencyResolver {
} }
if (pom == null) { if (pom == null) {
throw new ArtifactNotFoundException(dependency_, artifacts.stream().map(RepositoryArtifact::location).collect(Collectors.joining(", "))); var location = artifacts.stream().map(RepositoryArtifact::location).collect(Collectors.joining(", "));
if (location.isEmpty()) {
if (repositories_.isEmpty()) {
location = "[no repositories defined]";
}
else {
location = "[no pom locations defined]";
}
}
throw new ArtifactNotFoundException(dependency_, location);
} }
var xml = new Xml2MavenPom(parent, retriever_, repositories_); var xml = new Xml2MavenPom(parent, retriever_, repositories_);