Configuring triggers for maven goals

You can configure triggers that execute Maven goals before or after certain events, for example, compiling, running, or testing. These triggers are called compilation triggers and execution triggers respectively.

To set up a trigger
  1. On the Maven Projects tool window, right-click the desired node (a phase of the lifecycle, or a plugin).
  2. On the context menu, click one of the options:
    • Execute Before Make
    • Execute After Make
    • Execute Before Rebuild
    • Execute After Rebuild
    • Execute Before Run/Debug

    img

Associating maven goals with keyboard shortcuts

You can associate a Maven goal with a keyboard shortcut and execute commonly-used goals with a single key-stroke. In a Maven project, its goals appear under the Maven goals node in the Keymap dialog.

To associate a keyboard shortcut with a maven goal
  1. In the Maven Projects tool window, right-click the desired goal.
  2. On the context menu, choose Assign Shortcut. Keymap dialog appears.
  3. Configure keymap, as described in the section Configuring Keyboard Shortcuts.

Executing a maven goal

There are two ways to execute a Maven goal:

Results are displayed in the console of the Run tool window.

To build a lifecycle phase or a plugin
  1. Select the desired node in the Maven Projects tool window.
  2. Choose Run Goal on the context menu of the selection.
To run a maven goal as an application, do one of the following
  • Perform the regular procedure, as described in the section Running Applications.
  • Perform the shortcut procedure, which uses a Maven-specific run/debug configuration for each goal:

    Select the desired node in the Maven Projects tool window, and choose Run <goal>[run/debug configuration] on the context menu, or press Ctrl+Shift+F10.