diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java index 9b09fd6387..ac00320296 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java @@ -24,6 +24,8 @@ import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.manager.WagonManager; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; @@ -112,6 +114,8 @@ public class MavenEmbedder private PluginDescriptorBuilder pluginDescriptorBuilder; + private ArtifactFactory artifactFactory; + // ---------------------------------------------------------------------- // Configuration // ---------------------------------------------------------------------- @@ -327,6 +331,20 @@ public class MavenEmbedder return projects; } + // ---------------------------------------------------------------------- + // Artifacts + // ---------------------------------------------------------------------- + + public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type ) + { + return artifactFactory.createArtifact( groupId, artifactId, version, scope, type ); + } + + public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ) + { + return artifactFactory.createArtifact( groupId, artifactId, version, type, classifier ); + } + // ---------------------------------------------------------------------- // Plugins // ---------------------------------------------------------------------- @@ -603,6 +621,8 @@ public class MavenEmbedder wagonManager = (WagonManager) embedder.lookup( WagonManager.ROLE ); + artifactFactory = (ArtifactFactory) embedder.lookup( ArtifactFactory.ROLE ); + // ---------------------------------------------------------------------- // If an explicit local repository has not been set then we will use the // setting builder to use the maven defaults to help us find one.