mirror of https://github.com/apache/maven.git
o add method so that the artifact handler can be looked up, useful in IDEs where we want to look up whether a particular artifact should be added to the classpath.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@495101 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c416a33a4c
commit
26e8fb2081
|
@ -20,6 +20,8 @@ import org.apache.maven.Maven;
|
|||
import org.apache.maven.MavenTools;
|
||||
import org.apache.maven.SettingsConfigurationException;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||
|
@ -95,6 +97,8 @@ public class MavenEmbedder
|
|||
|
||||
private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
|
||||
|
||||
private ArtifactHandlerManager artifactHandlerManager;
|
||||
|
||||
private Maven maven;
|
||||
|
||||
private MavenTools mavenTools;
|
||||
|
@ -296,6 +300,11 @@ public class MavenEmbedder
|
|||
artifactResolver.resolve( artifact, remoteRepositories, localRepository );
|
||||
}
|
||||
|
||||
public ArtifactHandler getArtifactHandler( Artifact artifact )
|
||||
{
|
||||
return artifactHandlerManager.getArtifactHandler( artifact.getType() );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Plugins
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -466,6 +475,8 @@ public class MavenEmbedder
|
|||
defaultsPopulator = (MavenExecutionRequestDefaultsPopulator) container.lookup(
|
||||
MavenExecutionRequestDefaultsPopulator.ROLE );
|
||||
|
||||
artifactHandlerManager = (ArtifactHandlerManager) container.lookup( ArtifactHandlerManager.ROLE );
|
||||
|
||||
// These three things can be cached for a single session of the embedder
|
||||
settings = mavenTools.buildSettings( req.getUserSettingsFile(), req.getGlobalSettingsFile(), false );
|
||||
|
||||
|
|
Loading…
Reference in New Issue