Running Maven Builds

m2eclipse modifies the Run As... and Debug As... menus to allow you to run a Maven build within Eclipse. Figure 14-15 shows the Run As... menu for an m2eclipse project. From this menu you can run one of the more common lifecycle phases such as clean, install, or package. You can also load up the Run configuration dialog window and configure a Maven build with parameters and more options.

Running an Eclipse build with Run As...

Figure 14-15. Running an Eclipse build with Run As...

If you need to configure a Maven build with more options, you can choose Run Configurations... and create a new Maven build. Figure 14-16 shows the Run dialog for configuring a Maven build.

Configuring a Maven build as a run configuration

Figure 14-16. Configuring a Maven build as a run configuration

The Run configuration dialog allows you to specify multiple goals and profiles. It exposes options such as “skip tests” and “update snapshots” and allows you to customize everything from the project to the JRE to the environment variable. You can use this dialog to support any custom Maven build that you wish to launch with m2eclipse.

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.