In the earlier tutorials, we have seen how to install maven in eclipse. Now we will go ahead and create a simple maven project. Before proceeding, we assume you already installed Maven.
As mentioned earlier MAVEN helps us in creating the project structure, managing and downloading the dependencies. We need to define the required dependencies in pom.xml. We will look more in detail. (By default maven adds few dependencies specific to project structures and that will be based on the archetype that we choose).
First let us create a simple maven project
Step 1: Navigate to File Menu -> New, and check if Maven Project is displaying if yes, click on Maven Project. If NOT, please click on Other.
Step 2: After Clicking on Other, it will display 'select a wizard' screen, please type as Maven in the text box to filter and find Maven. After that Select Maven and Click on next button.
In the next screen, it will ask you to select project name and location. By default, 'Use default workspace location' will be selected. Just click on next button to proceed without making any changes.
Step 3: In the next screen, It will ask you to select an Archetype. Depending on the type of project that you are working, you need to choose the archetype.
Here we will choose a basic archetype 'quickstart' and Click on Next button
Step 4: It will ask you to 'Enter a group id for the artifact.' Click here to know more about Group ID and Artifacts.
We will input as shown in the below image. Version number will be by default 0.0.1-SNAPSHOT
Step 5: Click on Finish. Now Creating a maven project is Done. Lets see how the project is created. If you expand and see the project structure,
If you observe, it has downloaded Maven Dependencies. You can see by expanding the Maven Dependencies. And also it has created pom.xml file. The below is the pom.xml file which got created.
We can start adding the dependencies which ever you want like Selenium jars, Testng jars etc. By default, it has added junit dependency as said earlier, it will add the dependencies based on the 'Archetype' we select.