Developing with Eclipse and Maven

3.2. Create a Maven POM File

3.2. Create a Maven POM File

Another important feature m2eclipse offers is the ability to create a new Maven POM file. m2eclipse provides a wizard to easily create a new POM file inside of a project that is already in Eclipse. This POM creation wizard is shown in Figure 3.6, “Creating a New POM”:

Creating a New POM

Figure 3.6. Creating a New POM

Creating a new Maven POM is just a matter of selecting a project, entering the Group Id, Artifact Id, Version, choosing the Packaging type, and providing a Name into the fields provided and m2eclipse. Click the Next button to start adding dependencies.

Adding Dependencies to a New POM

Figure 3.7. Adding Dependencies to a New POM

As you can see in Figure 3.7, “Adding Dependencies to a New POM” here are no dependencies in the POM yet. Just click the Add button to query the central Maven repository for dependencies as shown next in Figure 3.8, “Querying the Central Repository for Dependencies”:

Querying the Central Repository for Dependencies

Figure 3.8. Querying the Central Repository for Dependencies

Querying for dependencies is as easy as entering the groupId for the artifact you need. Figure 3.8, “Querying the Central Repository for Dependencies” shows a query for org.apache.commons with commons-vfs expanded to see which versions are available. Highlighting the 1.1-SNAPSHOT version of commons-vfs and clicking OK takes you back to the dependency selection where you can either query for more artifacts or just click finish to create the POM. When you search for dependencies, m2eclipse is making use of the same Nexus repository index that is used in the Nexus Repository Manager, a repository manager introduced in "Repository Management with Nexus" (

Now that the you’ve seen the m2eclipse features for creating a new project, let’s look at a similar set of features for importing projects into Eclipse.