Module 3: Using Maven Repository and know What is POM.xml in a Maven Project

<<< Previous Chapter                                            Next Chapter >>>

POM stands for Project Object Model. pom.xml plays a key role in every Maven Project. A Maven project reads pom.xml and downloads all the required dependencies mentioned in pom.xml which are required to execute the project.

pom.xml is nothing but an index of all the configurations, build/source directories, plugins, dependencies which and open source and available to consume in any project.

After creating the project as is yesterday's tutorial Module 2: Setup & Initialize Automation Framework the Project looks like: 




Double click the pom.xml. THe current pom.xml looks like:

Now we need to Add a few dependencies that are required in almost every framework. You can also read about what these dependencies are and why they are used from Official Maven Repository. Now we will search and add below Plugins/Dependencies in our existing pom.xml:

Plugins:
maven-surefire-plugin


Dependencies:

  • log4j-api
  • log4j-core
  • poi-ooxml
  • log4j
  • commons-io
  • junit
  • selenium-java
  • testng 


The above dependencies can be copied and added to our pom.xml from Maven Repository as in screenshot above.

Try to add all the Dependencies by searching and adding manually by yourself. If not able to then you can copy it from below code snippet:

After adding all the dependencies pom.xml file should look like:

Now we know how to use Maven Repository and what is POM.xml in a Maven Project. Save the pom.xml using Ctrl+S and we have successfully updated our pom.xml file to be read by Maven. That's it for today. Happy Testing :)
<<< Previous Chapter                                            Next Chapter >>>

0 comments:

Post a Comment

Thanks a lot for your valuable Comment!