5

In an older version of Eclipse, the number of which I can't remember, there was an option when right-clicking a project under Run As of Maven Package.

In Springsource Tool Suite 2.9.0 built on Eclipse 3.7.2, this option is no longer there. I could create specific run configurations per project to quickly do a Maven package, but I found it rather handy having the one shortcut for doing a package no matter which project was selected without having to set it all up first.

Is there a way to get this option back?

DeejUK
  • 12,891
  • 19
  • 89
  • 169
  • Have you read [this question](http://stackoverflow.com/questions/9422142/missing-the-maven-package-menu-entry-in-eclipse)? just accept the change yourself and use new feature. – yorkw Mar 12 '12 at 20:05
  • Thanks for highlighting this. That solution still requires creating a new Run As config for every project, which isn't what I was looking for. – DeejUK Mar 13 '12 at 08:46
  • possible duplicate of http://stackoverflow.com/questions/9422142/missing-the-maven-package-menu-entry-in-eclipse – OO7 Aug 05 '14 at 09:02
  • another good answer here - http://stackoverflow.com/questions/10504620/add-new-maven-run-configuration-to-menu-in-eclipse – chrismarx Aug 17 '14 at 01:12

2 Answers2

13

I also recently wanted to have this option with the new version of m2eclipse. The best solution i could find is, to create a configuration with the goal package, and as base directory give a variable name ${selected_resource_loc}. Still you have to go to run configurations page, but at least you don't have to define a new configuration for each project, but use the predefined one.

  • right-click project
  • run as
  • run configurations..
  • double click maven build (to create a new configuration)
  • give a name for configuration e.g. package
  • click variables
  • select "selected_resource_loc" and click ok
  • write your goal e.g. "package" or "clean package"
  • run

The next time when you want to package another project, you can use this configuration again:

  • right-click project
  • run as
  • run configurations..
  • select your maven configuration
  • run
akcasoy
  • 6,497
  • 13
  • 56
  • 100
  • NOTE: to get this to work in Neon.2, I had to choose ${project_loc} for the base directory. ${selected_resource_loc} would not work (run button remained grayed out). – crig May 26 '17 at 15:49
2

If you prefer the features of the old m2eclipse, you can revert using the STS extensions page. Open up the STS dashboard and click on the extensions page at the bottom. Scroll down until you see the "m2eclipse" entry. Installing this, will uninstall m2eclipse v1.0 and install m2eclipse v0.13.

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148