To import the project into eclipse right click on the right side of eclipse and click import and then in general select import from existing projects and then select the location of project we just created in c drive i.e c\users\harsimran\maven\MyMavenProject
Then once the project is imported go pom.xml file of this project and we can check the dependencies.
Now let us say the dependency for junit is 3.8.1 and we want to add the latest one we can go to a website
https://mvnrepository.com/
and search junit click the latest stable version of junit copy its dependency code and paste it in pom.xml
in place of old junit dependency.
Then go to cmd and type mvn compile and new junit repository will be downloaded.
Then we right click our Project in Eclipse-->jAVA BUILD PATH-->Add new variable-->configure variable-->New Give name as M2_REPO and give address equal to C:\Users\harsimran.m2 i.e create M2_REPO variable pointing to our local M2 repositry Automatically all the jars will be picked up from M2_REPO jar files
Then go to the site search.maven.org and search selenium and then select the file name selenium server and click on latest stable version of 3.14 and copy paste the dependency in pom.xml file and again go to cmd and compile the maven project and then
Go to this location C:\Users\harsimran.m2\repository\org\seleniumhq\selenium
And we see selenium repository has been created and then we type the command mvn eclipse:eclipse
in cmd to add those selenium repository to our eclipse project as well.
Then under src/test/java and under the project we created i.e com.selenium.maven We can make two different jave classes and in each class make a test annotation and write some function like this
@Test
public void Googlefnc(){
System.out.println("this is google class");
} // TODO Auto-generated method stub
And then we can go to cmd and type maven package
and both these classes will be executed one by one