Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run "mvn clean install" in Eclipse

Tags:

eclipse

maven

Title says it all.

I want to run the console command mvn clean install on my project in question directly in Eclipse, not from the command line.

It would just be more convenient for me to do this, as I already have the project open in Eclipse. It would save me time if I would not have to navigate to the folder in Windows Explorer.

Not a big deal if I can't do this... but can I? And if so, how?

It would be great if I could just right click my project, then click "mvn clean install" from the context menu.

like image 910
Josh Avatar asked Nov 05 '13 16:11

Josh


People also ask

What is mvn Eclipse clean?

xml (like new dependencies or plugins) and want Eclipse to be aware of them. mvn clean install. The first command deletes target directory and then builds all you code and installs artifacts into local repository. Follow this answer to receive notifications.


2 Answers

I use eclipse STS, so the maven plugin comes pre-installed. However, if you aren't using STS (Springsource Tool Suite), you can still install the m2Eclipse plugin. Here is the link:

http://www.eclipse.org/m2e/

Once you have this installed, you should be able to run all the maven commands. To do so, from the package explorer, you would right click on either the maven project or the pom.xml in the maven project, highlight Run As, then click Maven Install.

Hope this helped.

like image 165
kruiz Avatar answered Sep 22 '22 12:09

kruiz


Run a custom maven command in Eclipse as follows:

  1. Right-click the maven project or pom.xml
  2. Expand Run As
  3. Select Maven Build...
  4. Set Goals to the command, such as: clean install -X

Note: Eclipse prefixes the command with mvn automatically.

like image 34
Vibha Avatar answered Sep 20 '22 12:09

Vibha