Working with Maven Repositories

m2eclipse also provides some tools to make working with Maven repositories a bit easier. These tools provide functionality for:

  • Searching for artifacts

  • Searching for Java classes

  • Indexing Maven repositories

Searching For Maven Artifacts and Java classes

m2eclipse adds a couple of items to the Eclipse navigation menu that make searching for Maven artifacts and Java classes easy work. Each option is available by clicking on the Navigate menu, as shown in Figure 14-21.

Searching for artifacts and classes

Figure 14-21. Searching for artifacts and classes

Notice the available options in Figure 14-21 under the Eclipse Navigate menu named Open Maven POM... and Open Type from Maven.... The Open Maven POM... option allows you to search the Maven repository for a given POM, as shown in Figure 14-22.

Searching for a POM

Figure 14-22. Searching for a POM

Upon selecting an artifact and clicking OK, the POM for that artifact is opened in Eclipse for browsing or editing. This is handy when you need to take a quick look at the POM for a given artifact.

The second m2eclipse option in the Navigate menu is named Open Type from Maven.... This feature allows you to search for a Java class by name in a remote repository. Upon opening this dialog, simply type “factorybean” and you’ll see many classes with the name FactoryBean ...

Get Maven: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.