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.

  1. Open eclipse → Click on file → New → Other → Maven → Maven Project → Click on Next


  2. Select Checkbox for "Create a simple project."

    Click on Next
  3. Enter group ID and Artifact ID

    Click on Finish and your maven project will be created.

  4. 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.
  5. pom.xml is used to manage dependencies.
Now, let's add required dependencies into our maven project.

<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

Popular Posts