From 8a606df7d3d157d8b3864cca81f54121e164a491 Mon Sep 17 00:00:00 2001 From: Anton Sviridov Date: Thu, 30 Jun 2022 18:48:38 +0100 Subject: [PATCH] Remove RepositoryUtils --- .../maven/MojoImplementation.scala | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/integrations/maven-bloop/src/main/scala/bloop/integrations/maven/MojoImplementation.scala b/integrations/maven-bloop/src/main/scala/bloop/integrations/maven/MojoImplementation.scala index ceaea99c9b..8f6404be48 100644 --- a/integrations/maven-bloop/src/main/scala/bloop/integrations/maven/MojoImplementation.scala +++ b/integrations/maven-bloop/src/main/scala/bloop/integrations/maven/MojoImplementation.scala @@ -10,7 +10,6 @@ import scala.util.Success import scala.util.Try import bloop.config.Config import bloop.config.Tag -import org.apache.maven.RepositoryUtils import org.apache.maven.artifact.Artifact import org.apache.maven.artifact.ArtifactUtils import org.apache.maven.execution.MavenSession @@ -22,6 +21,7 @@ import org.apache.maven.plugin.logging.Log import org.apache.maven.project.MavenProject import org.codehaus.plexus.util.xml.Xpp3Dom import org.eclipse.aether.artifact.DefaultArtifact +import org.eclipse.aether.artifact.DefaultArtifactType import org.eclipse.aether.resolution.ArtifactRequest import scala_maven.AppLauncher @@ -85,7 +85,26 @@ object MojoImplementation { val suffix = if (classifier.nonEmpty) s":$classifier" else "" log.info("Resolving artifact: " + artifact + suffix) val request = new ArtifactRequest() - request.setArtifact(RepositoryUtils.toArtifact(artifact)) + val handler = artifact.getArtifactHandler() + val artifactType = new DefaultArtifactType( + artifact.getType(), + handler.getExtension(), + handler.getClassifier(), + handler.getLanguage(), + handler.isAddedToClasspath(), + handler.isIncludesDependencies() + ) + request.setArtifact( + new DefaultArtifact( + artifact.getGroupId(), + artifact.getArtifactId(), + classifier, + handler.getExtension(), + artifact.getVersion(), + null, + artifactType + ) + ) request.setRepositories(mojo.getRemoteRepositories()) val result = mojo.getRepoSystem().resolveArtifact(session.getRepositorySession(), request) log.info("SUCCESS " + artifact)