Maven Project Configuration
We'll look at how to set up a Maven project and handle dependencies in this blog. We discussed dependency problems in the previous blog, and the maven project steps in to help.
So, let's create a maven project.
- Open eclipse → Click on file → New → Other → Maven → Maven Project → Click on Next
There are 4 packages viz, src/test/java, src/test/resources, src/main/java and src/main/resources.
All java files are stored in src/test/java and resources like excel or CSV files are stored in src/test/resources. Common utility java files are stored in src/main/java and external resources are stored in src/main/resources.- pom.xml is used to manage dependencies.
Now, let's add required dependencies into our maven project.
- Visit Maven Repository: Search/Browse/Explore (mvnrepository.com)
- Search Selenium java in search bar
- Click on selenium java option.
- Select latest version.
this webpage will display. - Copy that code and paste into pom.xml as shown
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
</dependencies>
Similarly, you can add other jar files as well.
Comments
Post a Comment