You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2023/07/19 11:37:02 UTC
[maven-resolver] branch master updated: [MRESOLVER-376] Alt fix (#311)
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 6efe87aa [MRESOLVER-376] Alt fix (#311)
6efe87aa is described below
commit 6efe87aa26ddc6854392eb95fa4e0550617d50b3
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Wed Jul 19 13:36:57 2023 +0200
[MRESOLVER-376] Alt fix (#311)
Solve the mixup of Artifact used as key, as in case of relocation
A1 -> A2, when A1 descriptor is read, the result will have
A2 artifact set.
So, in code, we must go for "originally asked" A1 artifact, as
in case of relocation, the descriptor will hold A1 relocation
target, that is A2, causing endless loop.
---
https://issues.apache.org/jira/browse/MRESOLVER-376
---
.../aether/internal/impl/collect/bf/BfDependencyCollector.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/bf/BfDependencyCollector.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/bf/BfDependencyCollector.java
index 9dfe99d9..56e6704e 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/bf/BfDependencyCollector.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/bf/BfDependencyCollector.java
@@ -554,7 +554,14 @@ public class BfDependencyCollector extends DependencyCollectorDelegate implement
DescriptorResolutionResult(
VersionRangeResult rangeResult, Version version, ArtifactDescriptorResult descriptor) {
- this(descriptor.getArtifact(), rangeResult);
+ // NOTE: In case of A1 -> A2 relocation this happens:
+ // ArtifactDescriptorResult read by ArtifactDescriptorResultReader for A1
+ // will return instance that will have artifact = A2 (as RelocatedArtifact).
+ // So to properly "key" this instance, we need to use "originally requested" A1 instead!
+ // In short:
+ // ArtifactDescriptorRequest.artifact != ArtifactDescriptorResult.artifact WHEN relocation in play
+ // otherwise (no relocation), they are EQUAL.
+ this(descriptor.getRequest().getArtifact(), rangeResult);
this.descriptors.put(version, descriptor);
}