------ The Maven Embedder ------ Jason van Zyl ------ 26 February 2007 ------ The Maven Embedder The Maven Embedder is used by the Maven CLI, by IDE integration projects like {{{http://mevenide.codehaus.org}Mevenide}} and potentially any tool that needs to embed Maven's capabilities. You could embed Maven in a Continuous Integration application to run Maven build, an application lifecycle management (ALF) tool, or Ant tasks that utilize Maven's functionality. These are just a few examples of what the Maven Embedder can be used for. A Simple Example %{snippet|id=simple-embedder-example|url=http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderExampleTest.java} A Note on Configuring Settings Currently there is a notion of a user settings, and a global settings where either can specify information about the following: * Local Repository * Proxies * Mirrors * Server Configurations * Plugin Groups [] If you are using the embedder it is entirely your responsibility to take user and global settings information and specify it in the embedder configuration. The embedder carries with it <<>> defaults about where these are located and how they are used. If you want your embedded use of Maven to mimic the behavior of the Maven CLI insofar as settings use then use the following code: %{snippet|id=mimic-cli|url=http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderExampleTest.java} Also note that the user and global settings are merged, and the user settings are dominant. Accessing the Underlying Plexus Container Though it is not recommended for general use, it is possible to get at the underlying Plexus Container instance if you wish to lookup custom components. The Maven Embedder was specifically designed to be used for Maven and not a general purpose use of Plexus. So if you use this method then you use it at your peril. You can access the Plexus Container using the following: %{snippet|id=plexus-container|url=http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderExampleTest.java}