The Maven build lifecycle has defined phases with goals that are executed when building and distributing the project. When you execute a goal, Maven will also execute all the preceding goals in the build lifecycle. You can invoke phase goals and plugin goals by mapping the goals to IDE actions, or you can create custom goals and invoke the goals individually. When you execute a goal, the Maven output with the plugin and goal identifiers are displayed in the Output window.
You do not need to build the project or compile individual classes to run the project in the IDE. By default, the IDE automatically compiles classes when you save them. These incrementally compiled files are storeed in a cache in your user directory and are copied to your project's build folder when you run or debug your project.
If you want to generate distributable files for the project, such as JAR files or WAR files, you need to build the project. When you build a Maven project using the IDE's Build command, by default the IDE executes the plugin goals in the install phase of the Maven lifecycle (builds the project and adds the artifact to the local repository).
To build the main project:
The IDE displays the Maven output and any compilation errors in the Output window. You can double-click any error to go to the location in the source code where the error occurred.
You can modify the goals that are executed by the Build command and other IDE commands by modifying Maven settings in the project's Properties window.
To build an individual project and its required projects:
The Build with Dependencies executes the reactor:make goal.
You can modify the project dependencies by adding libraries in the Projects window or by editing pom.xml in the editor.
IDE actions in the popup menu are mapped to Maven phases and goals. For example, by default the Build action in the IDE is mapped to the install phase in the Maven lifecycle. When you right-click the project node and choose Build, the IDE executes the goals described in the install phase to package the project and executes all the goals in the preceding phases in the build lifecycle.
You can modify the mapped Maven goals that are invoked by IDE actions by configuring actions in the project's Properties window or in the Maven tab in the Options window. For more, see Configuring Maven settings.
To customize the build for a Maven project you modify the POM to add or reconfigure plugins and dependencies. You can use the code completion in the editor to help you when adding details to pom.xml.
When you click OK, the IDE adds the plugin description to pom.xml and the goals to run as part of the build process. If you add a plugin that is not in the local repository, the required artifact will be automatically downloaded from a remote repository when required.