Eclipse + Maven: mvn eclipse:eclipse command

In this article, we will explore about one of the maven command “eclipse:eclipse

Actually this command is no longer required with latest versions of Eclipse IDE like Kepler, Luna or Mars

If maven is not integrated with Eclipse IDE like in older versions Indigo or Helios, then we can still use maven and bring dependencies into Eclipse

Note: Although, we can integrate maven with Eclipse manually using Marketplace or m2eplugin

Scenario

Assume we have created java based project outside Eclipse IDE i.e.; using maven archetype from command prompt. This is just a template, to add actual code we have to import it to eclipse environment [though not necessarily]

And added couple of spring dependencies to pom.xml

To import project into Eclipse IDE

Step 1: New –> Import –> General –> Existing Project into Workspace

1_Eclipse-Maven_eclipse_eclipse_command_exisitng

Step 2: Browse through the project that we have created using maven archetype

2_Eclipse-Maven_eclipse_eclipse_command_exisitng_import

Step 3: Upon importing into Eclipse workspace –> dependencies aren’t imported with project

Run “mvn eclipse:eclipse” command –> to update with dependencies

3_Eclipse-Maven_eclipse_eclipse_command_prompt

Final project with dependencies

4_Eclipse-Maven_eclipse_eclipse_command_running_dependencies

References

http://maven.apache.org/guides/mini/guide-ide-eclipse.html#Simple_Project
http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html

Happy Coding !!
Happy Learning !!

 

Eclipse + Maven: Plugin execution not covered by lifecycle configuration
Eclipse + Maven: Converting Web project to Maven project