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:
Jason van Zyl 2007-01-11 03:39:22 +00:00
parent c416a33a4c
commit 26e8fb2081
1 changed files with 11 additions and 0 deletions

View File

@ -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 );