Skip to content

Commit

Permalink
Avoid deprecated ArtifactFactory (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo authored Jan 6, 2025
1 parent 8b74a28 commit 3bcfbc2
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.Set;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
Expand Down Expand Up @@ -232,8 +231,6 @@ public void testRepositoryLayout() throws Exception {
mojo.useRepositoryLayout = true;
mojo.execute();

ArtifactFactory artifactFactory = lookup(ArtifactFactory.class);

File outputDirectory = mojo.outputDirectory;
ArtifactRepository targetRepository = new MavenArtifactRepository(
"local",
Expand All @@ -246,11 +243,12 @@ public void testRepositoryLayout() throws Exception {
File baseDirectory = Paths.get(targetRepository.getBasedir()).toFile();
assertTrue(baseDirectory.isDirectory());

org.apache.maven.repository.RepositorySystem repositorySystem =
lookup(org.apache.maven.repository.RepositorySystem.class);
for (Artifact artifact : artifacts) {
assertArtifactExists(artifact, targetRepository);

if (!artifact.getBaseVersion().equals(artifact.getVersion())) {
Artifact baseArtifact = artifactFactory.createArtifact(
Artifact baseArtifact = repositorySystem.createArtifact(
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getBaseVersion(),
Expand Down

0 comments on commit 3bcfbc2

Please sign in to comment.