Convert Maven project To eclipse project

This demo will show you how to create maven project form command prompt and convert it to dynamic eclipse web project.

  • Download Apache Maven from here: http://maven.apache.org/download.cgi
  • After download extract it to any folder
  • Go to command prompt:  Click Window –>All Program –>Accessories –> Command Prompt
  • Once your command prompt is open go to directory where you have extracted Maven then set class path of maven bin as below:

Create Dynamic Web Project Maven command prompt

  • To check if maven classpath set or not type mvn -version in command prompt as shown in above. It will show you Apache maven version.
  • Now we are all set to create Maven Project from prompt
  • From command prompt you could navigate to any directory wherever you want to create project for demo I have create workspace folder which is my eclipse workspace to create Maven project as below then enter following below command:

C:\Maven>cd C:\workspace

C:\workspace>mvn archetype:generate -DgroupId=com.javahonk -DartifactId=TestMavenWebProject -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

  • GroupId: Package structure
  • artifactId: Project name to be created.
  • maven-archetype-webapp: Maven type of project is web project
  • Press enter in command prompt: You will see first time it download jars to local directory and will create project with successful build as below

Create Dynamic Web Project Maven command prompt

 

  • Now go to your workspace directory you will see TestMavenWebProject created.

Convert Maven project To eclipse project

  • In the command prompt go to your newly created project directory

Convert Maven project To eclipse project

  • Paste below
mvn eclipse:eclipse -Dwtpversion=2.0

 

  • After you enter you will see maven start converting project to dynamic eclipse project and lastly you will see build successful as below:

[INFO]
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 19.306s
[INFO] Finished at: Wed Jan 29 22:43:30 EST 2014
[INFO] Final Memory: 8M/20M
[INFO] ————————————————————————
‘cmd’ is not recognized as an internal or external command,
operable program or batch file.
C:\workspace\TestMavenWebProject>

  • That’s it you converted maven project to eclipse dynamic web project

Leave a Reply

Your email address will not be published. Required fields are marked *