Managing the POM

We can edit our project POM within the Eclipse IDE by clicking on the pom.xml file. By default, it will be opened with the Maven POM editor that is shown in the following screenshot:

Managing the POM

Maven POM editor

By clicking on the Overview tab, we can edit the Maven coordinates and also the main POM elements such as packaging, name, description, project properties, project parent, and project modules. In the last tab, pom.xml, we can make changes to the POM file with a text editor. We can also see a tab that displays the Effective POM (described in Chapter 2, Core Maven Concepts) and one named Dependency Hierarchy, which is a representation of the dependency tree (see again Chapter 2, Core Maven Concepts). Project dependencies can be edited by clicking on the Dependencies tab, as shown in the following screenshot:

Managing the POM

Editing Maven dependencies

All the changes that we make to the project POM through the Maven POM editor are automatically reflected by the Eclipse IDE and the Eclipse project configuration is consequently updated. For example, if we add a dependency in our POM, even through the text editor, it will be immediately visible in the Package Explorer view under the Maven Dependencies classpath folder.

Sometimes, the pom.xml file is marked with a red cross and in the Problems view appears the error message Project configuration is not up to date with pom.xml. Run Maven->Update Project or use Quick Fix.

This means that a manual update of the project configuration is needed, and it can be done by right-clicking on the project and then on the Update Maven Project menu item, as shown in the following screenshot:

Managing the POM

Updating the Maven project configuration

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset