What is Maven?

In previous post, we have learnt how to execute the test cases using Selenium Grid. In this post, we will learn about Maven.

What is Maven?

Maven is basically a build automation tool mainly used for java projects. The meaning of word ‘Maven’ is “accumulator of knowledge” in yiddish. Our goal is to to learn how maven will be used with Selenium project.So we will provide an understanding of usage of maven in selenium project and working knowledge with some practical examples.

Maven provide a concept of project object Model(POM) file to manage project’s build, dependency and documentation.

What is a build tool?

As it name says, build tool takes care of building a process for project. It performs the below steps:

  • Generates source code (if auto-generated code is used)
  • Generates documentation from source code.
  • Installs the packaged code in local repository, server repository, or central repository.
  • Compiles source code.
  • Packages compiled code into JAR of ZIP file.

Problems without Maven:

When we work in a project, in most of the cases a no. of people work in a team if it is a big project.

  • Creating the right structure of the project for each team member so they should be on the same page.
  • A Set of jars will be used by developers, its important that they should use same set of jars across the team.
  • Project has to be built and deployed to make it work.

How does maven help to resolve the above problems?

  • It makes a project easy to build.
  • It provides project information (log document, cross referenced sources, mailing list, dependency list  etc.)
  • It provide uniform structure of the project across team.
  • It support different kind of plugin which helps in documentation , reporting etc.
  • Easily migrate to new features of Maven.
  • Providing guidelines for best practices development.

In simple terms, it provides you a file named as POM.xml when a maven project is created. It is an xml file that contains dependencies, required plugin, information about the project and configuration details used by Maven to build the project. First time it downloads the required dependencies from remote repository and keep it in a local repository called (.m2).  Next time, when we run the project it searches the jars file from local repository , if it does not find the required file there , then it will download from remote repository.

Maven arcchitecture


 

Ask Question
Have any question or suggestion for us?Please feel free to post in Q&A Forum
Avatar photo

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. This website is his window to the world. He believes that ,"Knowledge increases by sharing but not by saving".

You may also like...