Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing the ‘maven package’ menu entry in eclipse

Tags:

eclipse

maven

I'm using Eclipse 3.7 with m2eclipse. Previously I know there was a menu entry ‘maven package’ but since I reinstalled Ubuntu there is no entry and I have to ‘maven install’ to do the same.

Now I'm wondering if it is possible to get the ‘maven package’ back so I could test something without installing it and allow other projects to use the test version as dependency.

like image 861
xZise Avatar asked Feb 23 '12 22:02

xZise


People also ask

How do I fix missing Maven dependencies in Eclipse?

My problem solved by right click on project -> Maven -> Update project. Then the Maven Dependencies appear on the project explore. Save this answer.

How do I add a missing jar to Maven dependencies in Eclipse?

Just right click there and select Rebuild Index option. This will rebuild repository index for local use, and will help you to quickly add any JAR file dependency in your Maven project. That's all about how do you fix this problem of Maven not able to search dependencies in Eclipse.


2 Answers

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

At least you will not have to create a new configuration each time you want to package, as with maven build...

like image 50
akcasoy Avatar answered Sep 28 '22 09:09

akcasoy


Just use Maven Build... and type package in the goal field.

like image 22
JB Nizet Avatar answered Sep 28 '22 08:09

JB Nizet