This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
The following commit(s) were added to refs/heads/master by this push:
new 853288956 Bug: in certain cases Resolver caused build failure (#1975)
853288956 is described below
commit 853288956a17c87538cd2ff11e60bea1ce82e318
Author: Tamas Cservenak <[email protected]>
AuthorDate: Sat Jul 18 14:10:38 2026 +0200
Bug: in certain cases Resolver caused build failure (#1975)
While it should not. The result repository MAY be `null` in certain cases,
and that resulted in omission of recording ArtifactNotFoundEx as addException
method filters out null repositories and/or exceptions.
While not biggie, later on, if this resolution was in fact happening for a
POM, despite descriptor policy would be "ignore missing" (default in Maven 3
and 4), due not recorded ANFex, this error would not be recognized as "missing
POM", and would fail the build or artifact collection or anything involving
reading descriptor.
---
.../eclipse/aether/internal/impl/DefaultArtifactResolver.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultArtifactResolver.java
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultArtifactResolver.java
index 86784f024..a1c210fb5 100644
---
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultArtifactResolver.java
+++
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultArtifactResolver.java
@@ -414,7 +414,14 @@ public class DefaultArtifactResolver implements
ArtifactResolver {
if (result.getExceptions().isEmpty()) {
Exception exception =
new
ArtifactNotFoundException(request.getArtifact(), (RemoteRepository) null);
- result.addException(result.getRepository(),
exception);
+ // Note: result.getRepository() MAY BE null; in
cases when
+ // the artifact was not even tried by any remote
repository (snapshot vs repo policy)
+ // and local repository does not have it either
+ result.addException(
+ result.getRepository() != null
+ ? result.getRepository()
+ : ArtifactResult.NO_REPOSITORY,
+ exception);
}
RequestTrace trace =
RequestTrace.newChild(request.getTrace(), request);
artifactResolved(session, trace,
request.getArtifact(), null, result.getExceptions());