14

Is there some way to add to the existing maven configurations in the "run configuration menu", available in "Run -> Run as" in Eclipse? I'd like to add my commonly used goals, like "integration-test", to the existing ones, like "maven build" etc.

I used the variable "${project_loc}" for base directory, but how can I place the new configuration in the maven run configuration menu? I don't see the option in the preferences or anywhere.

2 Answers 2

19

Short answer is you can't. Eclipse generally encouraging to not clutter context menus.

However when using m2eclipse you can use Run As... / Maven Build... menu to create launch configurations for your Maven builds. After that you can use Run As... / Maven Build (or Alt-Shift-X, M shortcut) to invoke previously created configurations, so if there is more then one been created you'll see a selection dialog.

1
  • This way creates a new run configuration for each project that this command is used for. You should modify one configuration with this "${project_loc}" and use this one.
    – Naxos84
    Commented Dec 1, 2016 at 7:45
1

This is a very simple plugin project that fills this need: Eclipse Custom Maven Presets Plugin:

The Run As menu with a new item

You can see a new Maven clean package item with a blue icon, but according to the doc it's possible to add up to 9 custom items.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.