How to Create New Maven Project From Command Prompt For Selenium

Earlier, We already learnt how to download maven In Eclipse In THIS POST and how to create new maven project In eclipse In THIS POST. Now we are going to create new maven project from command prompt for selenium webdriver test. We already learnt how to download and configure
maven In windows manually In my previous post. Now let's start creating maven project from command prompt.
Step 1 : Create project folder and set path
First of all you need to create project folder where you wants to save maven project files. I am choosing D:/Maven path to store project files so created Maven folder In D: drive. Now open command prompt and set D:/Maven as working directory using bellow given commands.

  1. Type D: and press Enter button will change working directory to D: drive.
  2. Type cd Maven will set working directory as Maven folder.


Step 2 : List maven Maven Archetypes
First of all we need to get the list of Maven Archetypes using Maven Archetype plugin. There are many different Maven Archetypes but we need maven-archetype-quickstart archetype for our simple project creation. Run command mvn archetype:generate In command prompt. It will download Maven Archetype plugin and get the list of different archetypes as bellow. 



If you are running this command first time then It can take 2 to 5 minutes to Install Maven Archetype plugin and list all maven archetypes. It will do It automatically.

Step 3 : Choose Maven archetype from list
At the end of mvn archetype:generate command execution, You will get screen like bellow to choose Archetype number.


Default archetype Is maven-archetype-quickstart. So do not enter any number In above screen and just press keyboard ENTER button.

Step 4 : Choose quickstart version
It will ask you to choose quickstart version as bellow.


Do not enter any number In above screen and just press keyboard ENTER button. It will select latest version 6 Itself.

Step 5 : Enter groupId
Next step will ask you to enter groupId as shown bellow. It will be package name of maven project.


Enter com.demopack and press ENTER.

Step 6 : Enter artifactId
Next step will ask you to enter artifactId.


Enter MavenProject and press ENTER.

Step 7 : Enter value for version
Next step will ask you to enter version number.


Do not enter any number In above screen and just press keyboard ENTER button.

Step 8 : Enter value for package


Do not enter any number In above screen too and just press keyboard ENTER button.

Step 9 : Confirm property configuration
Next step will ask you to confirm property configuration of project Is correct or not as bellow.


Do not enter any thing In above screen too and just press keyboard ENTER button.

It will show you screen with BUILD SUCCESS as bellow. That means your project In maven has been created.


Step 10 : Check maven project created or not
Now go to D:\Maven\MavenProject to check project Is created or not. There will be src folder and pom.xml file as bellow.


There will be two different folders Inside src folder. 1.main 2.test. That means maven project Is created properly. Next post will describe you how to Import It In eclipse, create and run simple test of selenium webdriver In It.

2 comments: