DEV Community

Cover image for Maven Build Tool (for Selenium Java)
Anne Quinkenstein
Anne Quinkenstein

Posted on

Maven Build Tool (for Selenium Java)

What is Maven?

  • Softwareproject-Management-Tool to maintain and manage the project
  • Build-Management-Tool for Java Frameworks


  1. Central Maven Repository to get Dependencies
    Maven visits the website, downloads the needed jars and places it in the build path.
    e.g. Selenium Jars
    just find Selenium Repository
    Selenium Repo Search

  2. Maintaining common structure for all
    One common template across the organisation
    this is the empty skeleton:
    Selenium Repo Search

  3. Flexiblity in integrating with CI Tools
    e.g. Maven Commands wich are supported by Jenkins

  4. PlugsIns for Test Framework execution
    TestNG, JUnit


groupId : unique identifier (e.g. Selenium)
artifactId: sub-project of Group ID (e.g. Selenium-Java, a jar name)

Enter fullscreen mode Exit fullscreen mode

You can pass all this details and publish it in Maven, then other persons can simply clone it with groupId and artifactId.
Keyword 'test' has to be at the end of each javaclass-file, e.g.
Selenium Hierachie Folders

Create Maven Project in Eclipse

create Maven Project
Let it use default Workspace
Use maven-archetype-quickstart template
create Maven Project

Fill your POM.xml -File

  1. Get the Dependencies from Maven Repository Go to the maven repository and get each Dependency and put it inside the Dependencies
  2. Integrate sureFire Plugin to execute all your testcases in your project
to execute from CLI

(where POM.xml is laying)

  • mvn clean (to clean project)
  • mvn compile (to check for syntax errors)
  • mvn test (first checks dependencies

Integration of TestNG

Switching Test with Maven profiling

Discussion (0)