## 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

Field Summary
`static java.lang.String` `DEFAULT_LAYOUT_ID`
`static java.lang.String` `DEFAULT_LOCAL_REPO_ID`
`static java.lang.String` `userHome`

Constructor Summary
`MavenEmbedder()`

Method Summary
`java.util.List` `collectProjects(java.io.File basedir, java.lang.String[] includes, java.lang.String[] excludes)`
`org.apache.maven.artifact.Artifact` `createArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String scope, java.lang.String type)`
`org.apache.maven.artifact.Artifact` `createArtifactWithClassifier(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String type, java.lang.String classifier)`
`org.apache.maven.artifact.repository.ArtifactRepository` `createLocalRepository(java.io.File localRepository)`
`org.apache.maven.artifact.repository.ArtifactRepository` `createLocalRepository(org.apache.maven.settings.Settings settings)`
`org.apache.maven.artifact.repository.ArtifactRepository` `createLocalRepository(java.lang.String url, java.lang.String repositoryId)`
`org.apache.maven.artifact.repository.ArtifactRepository` `createRepository(java.lang.String url, java.lang.String repositoryId)`
`void` `execute(java.util.List projects, java.util.List goals, org.apache.maven.monitor.event.EventMonitor eventMonitor, org.apache.maven.wagon.events.TransferListener transferListener, java.util.Properties properties, java.io.File executionRootDirectory)`
`void` `execute(org.apache.maven.project.MavenProject project, java.util.List goals, org.apache.maven.monitor.event.EventMonitor eventMonitor, org.apache.maven.wagon.events.TransferListener transferListener, java.util.Properties properties, java.io.File executionRootDirectory)`
`java.util.List` `getAvailablePlugins()`
`java.lang.ClassLoader` `getClassLoader()`
`java.lang.String` `getGlobalChecksumPolicy()`
`java.util.List` `getLifecyclePhases()`
`org.apache.maven.artifact.repository.ArtifactRepository` `getLocalRepository()`
`java.io.File` `getLocalRepositoryDirectory()`
`MavenEmbedderLogger` `getLogger()`
`org.apache.maven.plugin.descriptor.PluginDescriptor` `getPluginDescriptor(SummaryPluginDescriptor summaryPluginDescriptor)`
`boolean` `isAlignWithUserInstallation()`
`boolean` `isInteractiveMode()`
`boolean` `isOffline()`
`org.apache.maven.model.Model` `readModel(java.io.File model)`
`org.apache.maven.project.MavenProject` `readProject(java.io.File mavenProject)`
`org.apache.maven.project.MavenProject` `readProjectWithDependencies(java.io.File mavenProject)`
`org.apache.maven.project.MavenProject` `readProjectWithDependencies(java.io.File mavenProject, org.apache.maven.wagon.events.TransferListener transferListener)`
`void` `resolve(org.apache.maven.artifact.Artifact artifact, java.util.List remoteRepositories, org.apache.maven.artifact.repository.ArtifactRepository localRepository)`
`void` `setAlignWithUserInstallation(boolean alignWithUserInstallation)`
`void` `setClassLoader(java.lang.ClassLoader classLoader)` Set the classloader to use with the maven embedder.
`void` `setGlobalChecksumPolicy(java.lang.String globalChecksumPolicy)`
`void` `setInteractiveMode(boolean interactiveMode)`
`void` `setLocalRepositoryDirectory(java.io.File localRepositoryDirectory)`
`void` `setLogger(MavenEmbedderLogger logger)`
`void` `setOffline(boolean offline)`
`void` `start()`
`void` `stop()`
`void` `writeModel(java.io.Writer writer, org.apache.maven.model.Model model)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### userHome

    public static final java.lang.String userHome

### DEFAULT_LOCAL_REPO_ID

    public static final java.lang.String DEFAULT_LOCAL_REPO_ID

See Also:
  Constant Field Values

### DEFAULT_LAYOUT_ID

    public static final java.lang.String DEFAULT_LAYOUT_ID

See Also:
  Constant Field Values

Constructor Detail

### MavenEmbedder

    public MavenEmbedder()

Method Detail

### setInteractiveMode

    public void setInteractiveMode(boolean interactiveMode)

### isInteractiveMode

    public boolean isInteractiveMode()

### setOffline

    public void setOffline(boolean offline)

### isOffline

    public boolean isOffline()

### setGlobalChecksumPolicy

    public void setGlobalChecksumPolicy(java.lang.String globalChecksumPolicy)

### getGlobalChecksumPolicy

    public java.lang.String getGlobalChecksumPolicy()

### isAlignWithUserInstallation

    public boolean isAlignWithUserInstallation()

### setAlignWithUserInstallation

    public void setAlignWithUserInstallation(boolean alignWithUserInstallation)

### setClassLoader

    public void setClassLoader(java.lang.ClassLoader classLoader)

  Set the classloader to use with the maven embedder.

  Parameters:
    `classLoader` -

### getClassLoader

    public java.lang.ClassLoader getClassLoader()

### setLocalRepositoryDirectory

    public void setLocalRepositoryDirectory(java.io.File localRepositoryDirectory)

### getLocalRepositoryDirectory

    public java.io.File getLocalRepositoryDirectory()

### getLocalRepository

    public org.apache.maven.artifact.repository.ArtifactRepository getLocalRepository()

### getLogger

    public MavenEmbedderLogger getLogger()

### setLogger

    public void setLogger(MavenEmbedderLogger logger)

### readModel

    public org.apache.maven.model.Model readModel(java.io.File model)
                                           throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
                                                  java.io.FileNotFoundException,
                                                  java.io.IOException

  Throws:
    `org.codehaus.plexus.util.xml.pull.XmlPullParserException`
    `java.io.FileNotFoundException`
    `java.io.IOException`

### writeModel

    public void writeModel(java.io.Writer writer,
                           org.apache.maven.model.Model model)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readProject

    public org.apache.maven.project.MavenProject readProject(java.io.File mavenProject)
                                                      throws org.apache.maven.project.ProjectBuildingException

  Throws:
    `org.apache.maven.project.ProjectBuildingException`

### readProjectWithDependencies

    public org.apache.maven.project.MavenProject readProjectWithDependencies(java.io.File mavenProject,
                                                                             org.apache.maven.wagon.events.TransferListener transferListener)
                                                                      throws org.apache.maven.project.ProjectBuildingException,
                                                                             org.apache.maven.artifact.resolver.ArtifactResolutionException,
                                                                             org.apache.maven.artifact.resolver.ArtifactNotFoundException

  Throws:
    `org.apache.maven.project.ProjectBuildingException`
    `org.apache.maven.artifact.resolver.ArtifactResolutionException`
    `org.apache.maven.artifact.resolver.ArtifactNotFoundException`

### readProjectWithDependencies

    public org.apache.maven.project.MavenProject readProjectWithDependencies(java.io.File mavenProject)
                                                                      throws org.apache.maven.project.ProjectBuildingException,
                                                                             org.apache.maven.artifact.resolver.ArtifactResolutionException,
                                                                             org.apache.maven.artifact.resolver.ArtifactNotFoundException

  Throws:
    `org.apache.maven.project.ProjectBuildingException`
    `org.apache.maven.artifact.resolver.ArtifactResolutionException`
    `org.apache.maven.artifact.resolver.ArtifactNotFoundException`

### collectProjects

    public java.util.List collectProjects(java.io.File basedir,
                                          java.lang.String[] includes,
                                          java.lang.String[] excludes)
                                   throws org.apache.maven.plugin.MojoExecutionException

  Throws:
    `org.apache.maven.plugin.MojoExecutionException`

### createArtifact

    public org.apache.maven.artifact.Artifact createArtifact(java.lang.String groupId,
                                                             java.lang.String artifactId,
                                                             java.lang.String version,
                                                             java.lang.String scope,
                                                             java.lang.String type)

### createArtifactWithClassifier

    public org.apache.maven.artifact.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(org.apache.maven.artifact.Artifact artifact,
                        java.util.List remoteRepositories,
                        org.apache.maven.artifact.repository.ArtifactRepository localRepository)
                 throws org.apache.maven.artifact.resolver.ArtifactResolutionException,
                        org.apache.maven.artifact.resolver.ArtifactNotFoundException

  Throws:
    `org.apache.maven.artifact.resolver.ArtifactResolutionException`
    `org.apache.maven.artifact.resolver.ArtifactNotFoundException`

### getAvailablePlugins

    public java.util.List getAvailablePlugins()

### getPluginDescriptor

    public org.apache.maven.plugin.descriptor.PluginDescriptor getPluginDescriptor(SummaryPluginDescriptor summaryPluginDescriptor)
                                                                            throws MavenEmbedderException

  Throws:
    `MavenEmbedderException`

### execute

    public void execute(org.apache.maven.project.MavenProject project,
                        java.util.List goals,
                        org.apache.maven.monitor.event.EventMonitor eventMonitor,
                        org.apache.maven.wagon.events.TransferListener transferListener,
                        java.util.Properties properties,
                        java.io.File executionRootDirectory)
                 throws org.codehaus.plexus.util.dag.CycleDetectedException,
                        org.apache.maven.lifecycle.LifecycleExecutionException,
                        org.apache.maven.BuildFailureException,
                        org.apache.maven.project.DuplicateProjectException,
                        org.apache.maven.project.MissingProjectException

  Throws:
    `org.codehaus.plexus.util.dag.CycleDetectedException`
    `org.apache.maven.lifecycle.LifecycleExecutionException`
    `org.apache.maven.BuildFailureException`
    `org.apache.maven.project.DuplicateProjectException`
    `org.apache.maven.project.MissingProjectException`

### execute

    public void execute(java.util.List projects,
                        java.util.List goals,
                        org.apache.maven.monitor.event.EventMonitor eventMonitor,
                        org.apache.maven.wagon.events.TransferListener transferListener,
                        java.util.Properties properties,
                        java.io.File executionRootDirectory)
                 throws org.codehaus.plexus.util.dag.CycleDetectedException,
                        org.apache.maven.lifecycle.LifecycleExecutionException,
                        org.apache.maven.BuildFailureException,
                        org.apache.maven.project.DuplicateProjectException,
                        org.apache.maven.project.MissingProjectException

  Throws:
    `org.codehaus.plexus.util.dag.CycleDetectedException`
    `org.apache.maven.lifecycle.LifecycleExecutionException`
    `org.apache.maven.BuildFailureException`
    `org.apache.maven.project.DuplicateProjectException`
    `org.apache.maven.project.MissingProjectException`

### getLifecyclePhases

    public java.util.List getLifecyclePhases()
                                      throws MavenEmbedderException

  Throws:
    `MavenEmbedderException`

### createLocalRepository

    public org.apache.maven.artifact.repository.ArtifactRepository createLocalRepository(java.io.File localRepository)
                                                                                  throws org.codehaus.plexus.component.repository.exception.ComponentLookupException

  Throws:
    `org.codehaus.plexus.component.repository.exception.ComponentLookupException`

### createLocalRepository

    public org.apache.maven.artifact.repository.ArtifactRepository createLocalRepository(org.apache.maven.settings.Settings settings)
                                                                                  throws org.codehaus.plexus.component.repository.exception.ComponentLookupException

  Throws:
    `org.codehaus.plexus.component.repository.exception.ComponentLookupException`

### createLocalRepository

    public org.apache.maven.artifact.repository.ArtifactRepository createLocalRepository(java.lang.String url,
                                                                                         java.lang.String repositoryId)
                                                                                  throws org.codehaus.plexus.component.repository.exception.ComponentLookupException

  Throws:
    `org.codehaus.plexus.component.repository.exception.ComponentLookupException`

### createRepository

    public org.apache.maven.artifact.repository.ArtifactRepository createRepository(java.lang.String url,
                                                                                    java.lang.String repositoryId)
                                                                             throws org.codehaus.plexus.component.repository.exception.ComponentLookupException

  Throws:
    `org.codehaus.plexus.component.repository.exception.ComponentLookupException`

### start

    public void start()
               throws MavenEmbedderException

  Throws:
    `MavenEmbedderException`

### stop

    public void stop()
              throws MavenEmbedderException

  Throws:
    `MavenEmbedderException`

Copyright © 2011. All Rights Reserved.