Category Archives: Maven

Eclipse: Running Maven As External Tool

I am an iOS developer by profession. Recently, I created my first mac app and a website to promote it. During website development, I used Maven for managing dependencies by integrating it with Eclipse as an External Tool. Later on, I learnt about an Eclipse plug-in called m2e which makes using Maven with Eclipse a breeze. m2e uses its own distribution of Maven packaged with the plugin. But I am yet to give m2e a try.

So for those of you like me who have a standalone Maven installation and want to use it with Eclipse without installing the m2e plugin, you can do it as follows

  1. Go to Eclipse > Run Menu > External Tools > External Tools Configuration.
  2. In the left pane, select Program and click on add new configuration.
  3. Add a name for the configuration in the Name field. I have used Clean ExpenseTrack.
  4. Provide the path where the Maven executable (mvn) file is located for Location field. On my Mac, I had it at /Users/Sayeed/apache-maven-3.1.1/bin/mvn. Windows users should give <path-to-maven-installation>/bin/mvn.bat
  5. Provide the path where your project file is located for Working Directory field.
  6. Provide the mvn command for Arguments field. In this example, I have used clean.

external_tools

That’s it. You are ready to use mvn clean command by clicking Run. The command’s output gets redirected to Eclipse Console. You can add more commands following the same steps. Cheers!!!.

Advertisements