Skip to content

Commit

Permalink
[MRESOLVER-547] Just use setVersion (#483)
Browse files Browse the repository at this point in the history
No need for full copy, Artifact is already immutable.
Moreover, the instance may be not DefaultArtifact but
something else. And finally, setVersion already
have "optimization" to return this if version is
same as the one we want to copy with.

---

https://issues.apache.org/jira/browse/MRESOLVER-547
  • Loading branch information
cstamas authored Apr 25, 2024
1 parent c1b24c6 commit 4f16d5e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
jobs:
build:
name: Verify
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v3
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
with:
ff-site-run: false
maven-matrix: '[ "3.9.6" ]'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.ArtifactType;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.collection.CollectRequest;
import org.eclipse.aether.collection.DependencyManager;
import org.eclipse.aether.collection.DependencySelector;
Expand Down Expand Up @@ -431,14 +429,7 @@ private void resolveArtifactDescriptorAsync(Args args, DependencyProcessingConte
private ArtifactDescriptorResult resolveDescriptorForVersion(
Args args, DependencyProcessingContext context, Results results, Dependency dependency, Version version) {
Artifact original = dependency.getArtifact();
Artifact newArtifact = new DefaultArtifact(
original.getGroupId(),
original.getArtifactId(),
original.getClassifier(),
original.getExtension(),
version.toString(),
original.getProperties(),
(ArtifactType) null);
Artifact newArtifact = original.setVersion(version.toString());
Dependency newDependency =
new Dependency(newArtifact, dependency.getScope(), dependency.isOptional(), dependency.getExclusions());
DependencyProcessingContext newContext = context.copy();
Expand Down

0 comments on commit 4f16d5e

Please sign in to comment.