org.apache.maven.embedder
Class MavenEmbedder
java.lang.Object
org.apache.maven.embedder.MavenEmbedder
public class MavenEmbedder
- extends java.lang.Object
Class intended to be used by clients who wish to embed Maven into their applications.
- Author:
- Jason van Zyl
Method Summary |
Artifact |
createArtifact(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
java.lang.String scope,
java.lang.String type)
|
Artifact |
createArtifactWithClassifier(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
java.lang.String type,
java.lang.String classifier)
|
MavenExecutionResult |
execute(MavenExecutionRequest request)
|
java.util.List |
getAllLifecyclePhases()
|
ArtifactHandler |
getArtifactHandler(Artifact artifact)
|
java.util.List |
getBuildLifecyclePhases()
|
BuildPlan |
getBuildPlan(java.util.List goals,
MavenProject project)
|
BuildPlan |
getBuildPlan(java.util.List goals,
MavenProject project,
boolean allowUnbindableMojos)
|
org.codehaus.plexus.classworlds.ClassWorld |
getClassWorld()
|
java.util.List |
getCleanLifecyclePhases()
|
Configuration |
getConfiguration()
|
java.util.List |
getDefaultLifecyclePhases()
|
MavenExecutionRequest |
getDefaultRequest()
|
java.util.List |
getLifecyclePhases()
|
ArtifactRepository |
getLocalRepository()
|
MavenEmbedderLogger |
getLogger()
|
org.codehaus.plexus.PlexusContainer |
getPlexusContainer()
Return the instance of the plexus container being used in the embedder. |
Settings |
getSettings()
|
java.util.List |
getSiteLifecyclePhases()
|
boolean |
isOffline(MavenExecutionRequest request)
|
Model |
readModel(java.io.File file)
|
Model |
readModel(java.io.Reader reader)
|
MavenProject |
readProject(java.io.File mavenProject)
|
MavenExecutionResult |
readProjectWithDependencies(MavenExecutionRequest request)
This method is used to grab the list of dependencies that belong to a project so that a UI
can be populated. |
static Settings |
readSettings(java.io.File file)
|
void |
resolve(Artifact artifact,
java.util.List remoteRepositories,
ArtifactRepository localRepository)
|
void |
setLogger(MavenEmbedderLogger logger)
|
void |
stop()
|
static ConfigurationValidationResult |
validateConfiguration(Configuration configuration)
|
protected void |
verifyPlugin(Plugin plugin,
MavenProject project)
mkleint: protected so that IDE integrations can selectively allow downloading artifacts
from remote repositories (if they prohibit by default on project loading) |
void |
writeModel(java.io.Writer writer,
Model model)
|
void |
writeModel(java.io.Writer writer,
Model model,
boolean namespaceDeclaration)
|
static void |
writeSettings(java.io.File file,
Settings settings)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_LOCAL_REPO_ID
public static final java.lang.String DEFAULT_LOCAL_REPO_ID
- See Also:
- Constant Field Values
userHome
public static final java.lang.String userHome
userMavenConfigurationHome
public static final java.io.File userMavenConfigurationHome
defaultUserLocalRepository
public static final java.io.File defaultUserLocalRepository
DEFAULT_USER_SETTINGS_FILE
public static final java.io.File DEFAULT_USER_SETTINGS_FILE
DEFAULT_GLOBAL_SETTINGS_FILE
public static final java.io.File DEFAULT_GLOBAL_SETTINGS_FILE
MavenEmbedder
public MavenEmbedder(Configuration embedderConfiguration)
throws MavenEmbedderException
- Throws:
MavenEmbedderException
getDefaultRequest
public MavenExecutionRequest getDefaultRequest()
getClassWorld
public org.codehaus.plexus.classworlds.ClassWorld getClassWorld()
getLocalRepository
public ArtifactRepository getLocalRepository()
getSettings
public Settings getSettings()
getLogger
public MavenEmbedderLogger getLogger()
setLogger
public void setLogger(MavenEmbedderLogger logger)
readModel
public Model readModel(java.io.File file)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
java.io.IOException
- Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserException
java.io.IOException
readModel
public Model readModel(java.io.Reader reader)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
java.io.IOException
- Throws:
org.codehaus.plexus.util.xml.pull.XmlPullParserException
java.io.IOException
writeModel
public void writeModel(java.io.Writer writer,
Model model,
boolean namespaceDeclaration)
throws java.io.IOException
- Throws:
java.io.IOException
writeModel
public void writeModel(java.io.Writer writer,
Model model)
throws java.io.IOException
- Throws:
java.io.IOException
writeSettings
public static void writeSettings(java.io.File file,
Settings settings)
throws java.io.IOException
- Throws:
java.io.IOException
readSettings
public static Settings readSettings(java.io.File file)
throws java.io.IOException,
SettingsConfigurationException
- Throws:
java.io.IOException
SettingsConfigurationException
verifyPlugin
protected void verifyPlugin(Plugin plugin,
MavenProject project)
throws org.codehaus.plexus.component.repository.exception.ComponentLookupException,
ArtifactResolutionException,
PluginVersionResolutionException,
ArtifactNotFoundException,
InvalidPluginException,
PluginManagerException,
PluginNotFoundException,
PluginVersionNotFoundException
- mkleint: protected so that IDE integrations can selectively allow downloading artifacts
from remote repositories (if they prohibit by default on project loading)
- Throws:
org.codehaus.plexus.component.repository.exception.ComponentLookupException
ArtifactResolutionException
PluginVersionResolutionException
ArtifactNotFoundException
InvalidPluginException
PluginManagerException
PluginNotFoundException
PluginVersionNotFoundException
readProject
public MavenProject readProject(java.io.File mavenProject)
throws ProjectBuildingException,
MavenExecutionException
- Throws:
ProjectBuildingException
MavenExecutionException
readProjectWithDependencies
public MavenExecutionResult readProjectWithDependencies(MavenExecutionRequest request)
- This method is used to grab the list of dependencies that belong to a project so that a UI
can be populated. For example, a list of libraries that are used by an Eclipse, Netbeans, or
IntelliJ project.
createArtifact
public Artifact createArtifact(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
java.lang.String scope,
java.lang.String type)
createArtifactWithClassifier
public Artifact createArtifactWithClassifier(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
java.lang.String type,
java.lang.String classifier)
resolve
public void resolve(Artifact artifact,
java.util.List remoteRepositories,
ArtifactRepository localRepository)
throws ArtifactResolutionException,
ArtifactNotFoundException
- Throws:
ArtifactResolutionException
ArtifactNotFoundException
getArtifactHandler
public ArtifactHandler getArtifactHandler(Artifact artifact)
getBuildPlan
public BuildPlan getBuildPlan(java.util.List goals,
MavenProject project)
throws MavenEmbedderException
- Throws:
MavenEmbedderException
getBuildPlan
public BuildPlan getBuildPlan(java.util.List goals,
MavenProject project,
boolean allowUnbindableMojos)
throws MavenEmbedderException
- Throws:
MavenEmbedderException
getLifecyclePhases
public java.util.List getLifecyclePhases()
getAllLifecyclePhases
public java.util.List getAllLifecyclePhases()
getDefaultLifecyclePhases
public java.util.List getDefaultLifecyclePhases()
getBuildLifecyclePhases
public java.util.List getBuildLifecyclePhases()
getCleanLifecyclePhases
public java.util.List getCleanLifecyclePhases()
getSiteLifecyclePhases
public java.util.List getSiteLifecyclePhases()
stop
public void stop()
throws MavenEmbedderException
- Throws:
MavenEmbedderException
validateConfiguration
public static ConfigurationValidationResult validateConfiguration(Configuration configuration)
getConfiguration
public Configuration getConfiguration()
isOffline
public boolean isOffline(MavenExecutionRequest request)
throws MavenEmbedderException
- Throws:
MavenEmbedderException
execute
public MavenExecutionResult execute(MavenExecutionRequest request)
getPlexusContainer
public org.codehaus.plexus.PlexusContainer getPlexusContainer()
- Return the instance of the plexus container being used in the embedder.
- Returns:
- The plexus container used in the embedder.
Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.