Using the maven embedder

I was doing some work on Hudson's maven2 integration last night. It currently uses an old and unsupported version of the maven embedder. My aim was to 'upgrade' Hudson to use a more 'supported' embedder version, so the project can benefit from better maven2 build support. Those of you that don't know what the embedder is, read this mini guide as a starting point.

Getting the embedder to run inside your application is actually quite easy if you avoid the pitfall of using the old and unsupported 2.0.4 binaries. Instead, make sure to use the latest 2.1-SNAPSHOT all-in-one binary (at the time of this post it is called maven-embedder-2.1-20070830.163428-16-shaded.jar). Adding this jar to your Eclipse/IDEA project is all you need to do to get the example from the guide going.

In summary,

  1. Create a new project in your IDE, add above all-in-one jar as a dependency.
  2. Copy-paste the code from the mini guide.
  3. Change the first line to point to a little sample maven2 project.
I also recommend having a look at the embedder integration tests for examples of how to do more non-trivial things with the embedder.

No comments: