Home » Posts tagged 'generate maven project structure'
Tag Archives: generate maven project structure
Creating Maven Project from Command Prompt
Previous Topic , In this tutorial we will learn Creating Maven Project from Command Prompt?
Creating Maven Project from Command Prompt
We can create maven project by two ways.One is by command prompt and another is by eclipse ide, let discuss the using command prompt.
Steps to create maven project from command prompt are below:
1) Open the command prompt by opening Run and type cmd and enter.
2) Take your path till the folder structure of your eclipse workspace . Type the command mvn archetype:generate and click enter. This command basically generates the maven project and take few seconds.
3) Now in cmd during process of generating maven project, it will ask to choose a number, type the number same as mentioned in cmd for me its 1476
4) Again it will ask to choose a number which is basically the maven archetype version, you can choose the updated version, for me its 8. and click to enter after that it will start downloading the files for updated version to create folder structure of maven project
5) Now it will ask for ‘group id’ which means you have to define the package structure to your maven project, I am defining the package as com.code2test
6) Next step is to define the ‘artifact Id ‘, which is basically the project name, i name it as MavenProject
7) Next step is to define the version, for this you have provide any number (you can give you build number of version number of your project code) , I give it 1.0 along with package propery version and hit enter.
8) Now the step is to provide the confirmation of you maven poject, for this type ‘Y’ and enter.
9) Now you will get the message of Build confirmation, go to your project workspace there you will see the maven project is been created on the folder structure.(As in screenshot).
Once your project is created it time to maven your maven project compatible with eclipse ide or in other words can imported to eclipse.
For making maven project compatible with eclipse project, firstly go to the folder structure of the recently created maven project for me its (Maven Project) and type the command mvn eclipse:eclipse and click enter
10) Once the process of making maven project compatible with eclipse project is completed, we will get ‘Build success’ message.
11) Now go to eclipse select-> File->import->Maven->Existing maven project and click next.
12) select newly created maven from workspace on click to ‘Browse’ button under Import Maven Projects window and click to finish.
We can see that the maven project gets imported to eclipse ide.
So following the above steps we can create maven project from CMD prompt and perform assigned task. Now in next topic we will discuss how to create maven project through Eclipse.