MAVEN
WHAT IS MAVEN?
• Maven is a build tool and based on a software project management
tool.
• Development team can automate the project's build infrastructure in
almost no time as Maven uses a standard directory layout and a default
build lifecycle.
• Maven can set-up the way to work as per standards in a very short
time.
• The project setups are simple and reusable, it makes life of developer
easy while creating reports, checks, build and testing automation
setups.
OBJECTIVES OF MAVEN
• It is reusable and maintainable.
• It making build process easy.
• It gives quality project information.
• Transparent migration to new features.
• Guideline for best development practices.
MAVEN PROVIDES DEVELOPERS
WAYS TO MANAGE
• Builds.
• Documentation.
• Reporting.
• Dependencies.
• SCMs.
• Releases.
• Distribution.
• Mailing list.
ADVANTAGE OF MAVEN
• It is an easy to start to the project in different environment.
• It is easy to build your project to a jar, as per requirement.
• Easily add new dependencies by writing the dependency code in the
pom file.
DISADVANTAGE OF MAVEN
• Maven code for an existing dependency is not available,
then cannot add that dependency.
• Maven installation along with plugin is must.
DIFFERENCE BETWEEN ANT VS MAVEN?
Maven
• Maven is a project management tool.
• It has a convention to compiled code,
place source code.
• It is declarative, everything define in
the pom.xml file.
• There is a life cycle in Maven and it is
a Framework.
• The Maven plugins are reusable and it
is more preferred than Ant.
Ant
• Ant is a build tool.
• It doesn't have formal conventions.
• It is procedural, to give proper
information about what to do and
when to do through code.
• There is a no life cycle in Ant and it is
a toolbox.
• The ant scripts are not reusable and it
is not so preferred than Maven.
MAVEN ARCHITECTURE
Local
Repository
Project.xml
Maven.xml
Maven
Remote
Repository
Site
HTTP
HOW TO INSTALL MAVEN ON WINDOW?
• Make sure JDK is installed.
Download Maven Archive
http://maven.apache.org/down
load.html.
• Extract it to a files
• Set Maven environment
variables.
• Add maven environment
variables in advanced
system properties.
• Maven is added to
environment variables
• Next in system variable
select path and click on edit
variable.
• Add %MAVEN_HOME%bin to
path.
• Verify Maven installation.
MAVEN REPOSITORY
• A Maven repository is a directory of packaged JAR file with
pom.xml file.
• It searches for dependencies in the repositories.
• There are three types of repository.
• Local Repository
• Central Repository
• Remote Repository
TYPES OF REPOSITORY
Local Repository
Central
Repository
Remote
Repository
LOCAL REPOSITORY
• Maven local repository is a local folder on a system.
• It is created by the maven when you run any maven command.
• It Stores all dependency library jars, plugin jars, etc on your
development machine.
• When Maven downloads the dependency jars it stores the jar files in
the local Maven repository.
• Maven creates a local repository under %USER_HOME% Directory.
CENTRAL REPOSITORY
• Maven central repository is repository managed by Maven community.
• It contains a large number of commonly used libraries And can publish own
libraries to Maven central repository as well.
• When maven cannot find any dependency jar file on a local repository, it starts
searching on a central repository on a URL: http://repo1.maven.org/maven2/.
• Search a jar file in central repository.
REMOTE REPOSITORY
• Sometime need to set up a Maven repository inside a company or a
project development team to host own libraries.
• The company maintained repository is outside developer's machine
is called remote repository.
BUILD LIFE CYCLE
• It is a well defined sequences of phases.
• It is in order which goals are to be executed.
• Each phases consist of sequence of goals.
• If one build life cycle is executed, all build phases will
executed.
• Build plug in:
• Add plugin to he pom file when it need to perform a
certain a set of project which are not covered by
maven build phases and goals.
• Every task is done through plug in
• It gives a set of goals.
• Plug in is mentioned in pom.xml file using plugin
elements.
PROJECT OBJECT MODEL (POM)
• POM is an Project Object Model and it is fundamental unit of work in Maven.
• POM is stored in xml file.
• It also has goals and plugin
• It contains information of project and configuration information for the maven to
build the project such as dependencies, build directory, source directory, test
source directory, plugin, goals etc.
• Maven reads the pom.xml file, then executes the goal.
STRUCTURE OF MAVEN POM.XML FILE
• Project
• It is the root element of pom.xml file.
• Model version
• It is the sub element of project.
• It specifies the model Version.
• It should be set to 4.0.0.
• Group id
• It is the sub element of project.
• It specifies the id for the project group.
• Artifact id
• It specifies the id for the artifact.
• Artifact is something that is either produced or used by a project.
• Examples JARs, source and binary distributions, and WARs.
• Version
• It specifies the version of the artifact under given group.
• Packaging
• Defines packaging type such as jar, war etc.
• Name
• Defines name of the maven project.
• Dependies
• Defines dependencies for this project.
• Dependency
• Defines a dependency. It is used inside dependencies.
• Scope
• Defines scope for this maven project. It can be compile, provided,
runtime, test and system.
JAVA PROGRAM USING MAVEN
package maven.selenium.testng;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class DemoClass {
@Test
public void test() throws InterruptedException
{
System.setProperty("webdriver.chrome.driver","C:UsersArvind PhulareDesktopchromedriver.exe");
WebDriver driver = new ChromeDriver();
String baseUrl = "<a href="http://newtours.demoaut.com/">http://newtours.demoaut.com/</a>";
String expectedTitle = "Welcome: Mercury Tours";
String actualTitle = "";
driver.get(baseUrl);
actualTitle = driver.getTitle();
Thread.sleep(3000);
if (actualTitle.contentEquals(expectedTitle)){
System.out.println("Test Passed!");
}
else
{
System.out.println("Test Failed");
}
driver.close();
}
}
HOW TO INSTALL MAVEN IN ECLIPSE
• Open Eclipse ID and click
help and go to install new
software.
• Then opened, click on
the Add button to add a new
repository.
• Fill the name and location
information Add repository
box
• Then click ok.
• After pending finished,
select all and click next.
• Accept the terms of the
license agreement and
click Finish
• At the end of the
installation, restart your
Eclipse. Click Yes to
perform the restart.
CREATE MAVEN PROJECT IN
ECLIPSE
Maven project build in automation testing in eclipse
Maven project build in automation testing in eclipse
Maven project build in automation testing in eclipse
THANK YOU

More Related Content

PDF
Mavennotes.pdf
PPT
Mavenppt
PPTX
PPTX
Introduction to Maven for beginners and DevOps
PDF
Build Automation using Maven
PPT
MAVEN
Mavennotes.pdf
Mavenppt
Introduction to Maven for beginners and DevOps
Build Automation using Maven
MAVEN

Similar to Maven project build in automation testing in eclipse (20)

PPTX
Maven Basics - Explained
PPT
Maven 2 features
PPTX
An Introduction to Maven
PDF
A-Z_Maven.pdf
PDF
Apache maven, a software project management tool
PPTX
Maven in mulesoft
ODP
Maven in Java EE project
PPTX
Introduction to maven
PDF
Fundamental of apache maven
PDF
Apache maven
PPT
Introduction tomaven
PPT
PPTX
Ci jenkins maven svn
PDF
Java Builds with Maven and Ant
PPTX
Maven
PDF
Introduction to maven, its configuration, lifecycle and relationship to JS world
PPTX
Maven and versioning
PPT
Maven Introduction
PPSX
Maven Presentation - SureFire vs FailSafe
PDF
Intelligent Projects with Maven - DevFest Istanbul
Maven Basics - Explained
Maven 2 features
An Introduction to Maven
A-Z_Maven.pdf
Apache maven, a software project management tool
Maven in mulesoft
Maven in Java EE project
Introduction to maven
Fundamental of apache maven
Apache maven
Introduction tomaven
Ci jenkins maven svn
Java Builds with Maven and Ant
Maven
Introduction to maven, its configuration, lifecycle and relationship to JS world
Maven and versioning
Maven Introduction
Maven Presentation - SureFire vs FailSafe
Intelligent Projects with Maven - DevFest Istanbul
Ad

Recently uploaded (20)

PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PPTX
Information Storage and Retrieval Techniques Unit III
PDF
Soil Improvement Techniques Note - Rabbi
PDF
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PPTX
Feature types and data preprocessing steps
PPTX
CyberSecurity Mobile and Wireless Devices
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PPTX
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PPTX
introduction to high performance computing
PPTX
Software Engineering and software moduleing
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PDF
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
Information Storage and Retrieval Techniques Unit III
Soil Improvement Techniques Note - Rabbi
22EC502-MICROCONTROLLER AND INTERFACING-8051 MICROCONTROLLER.pdf
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Feature types and data preprocessing steps
CyberSecurity Mobile and Wireless Devices
Fundamentals of safety and accident prevention -final (1).pptx
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
introduction to high performance computing
Software Engineering and software moduleing
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
BIO-INSPIRED ARCHITECTURE FOR PARSIMONIOUS CONVERSATIONAL INTELLIGENCE : THE ...
Categorization of Factors Affecting Classification Algorithms Selection
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
Ad

Maven project build in automation testing in eclipse

  • 2. WHAT IS MAVEN? • Maven is a build tool and based on a software project management tool. • Development team can automate the project's build infrastructure in almost no time as Maven uses a standard directory layout and a default build lifecycle. • Maven can set-up the way to work as per standards in a very short time. • The project setups are simple and reusable, it makes life of developer easy while creating reports, checks, build and testing automation setups.
  • 3. OBJECTIVES OF MAVEN • It is reusable and maintainable. • It making build process easy. • It gives quality project information. • Transparent migration to new features. • Guideline for best development practices.
  • 4. MAVEN PROVIDES DEVELOPERS WAYS TO MANAGE • Builds. • Documentation. • Reporting. • Dependencies. • SCMs. • Releases. • Distribution. • Mailing list.
  • 5. ADVANTAGE OF MAVEN • It is an easy to start to the project in different environment. • It is easy to build your project to a jar, as per requirement. • Easily add new dependencies by writing the dependency code in the pom file.
  • 6. DISADVANTAGE OF MAVEN • Maven code for an existing dependency is not available, then cannot add that dependency. • Maven installation along with plugin is must.
  • 7. DIFFERENCE BETWEEN ANT VS MAVEN? Maven • Maven is a project management tool. • It has a convention to compiled code, place source code. • It is declarative, everything define in the pom.xml file. • There is a life cycle in Maven and it is a Framework. • The Maven plugins are reusable and it is more preferred than Ant. Ant • Ant is a build tool. • It doesn't have formal conventions. • It is procedural, to give proper information about what to do and when to do through code. • There is a no life cycle in Ant and it is a toolbox. • The ant scripts are not reusable and it is not so preferred than Maven.
  • 9. HOW TO INSTALL MAVEN ON WINDOW? • Make sure JDK is installed.
  • 11. • Extract it to a files
  • 12. • Set Maven environment variables.
  • 13. • Add maven environment variables in advanced system properties.
  • 14. • Maven is added to environment variables
  • 15. • Next in system variable select path and click on edit variable.
  • 17. • Verify Maven installation.
  • 18. MAVEN REPOSITORY • A Maven repository is a directory of packaged JAR file with pom.xml file. • It searches for dependencies in the repositories. • There are three types of repository. • Local Repository • Central Repository • Remote Repository
  • 19. TYPES OF REPOSITORY Local Repository Central Repository Remote Repository
  • 20. LOCAL REPOSITORY • Maven local repository is a local folder on a system. • It is created by the maven when you run any maven command. • It Stores all dependency library jars, plugin jars, etc on your development machine. • When Maven downloads the dependency jars it stores the jar files in the local Maven repository. • Maven creates a local repository under %USER_HOME% Directory.
  • 21. CENTRAL REPOSITORY • Maven central repository is repository managed by Maven community. • It contains a large number of commonly used libraries And can publish own libraries to Maven central repository as well. • When maven cannot find any dependency jar file on a local repository, it starts searching on a central repository on a URL: http://repo1.maven.org/maven2/. • Search a jar file in central repository.
  • 22. REMOTE REPOSITORY • Sometime need to set up a Maven repository inside a company or a project development team to host own libraries. • The company maintained repository is outside developer's machine is called remote repository.
  • 23. BUILD LIFE CYCLE • It is a well defined sequences of phases. • It is in order which goals are to be executed. • Each phases consist of sequence of goals. • If one build life cycle is executed, all build phases will executed.
  • 24. • Build plug in: • Add plugin to he pom file when it need to perform a certain a set of project which are not covered by maven build phases and goals. • Every task is done through plug in • It gives a set of goals. • Plug in is mentioned in pom.xml file using plugin elements.
  • 25. PROJECT OBJECT MODEL (POM) • POM is an Project Object Model and it is fundamental unit of work in Maven. • POM is stored in xml file. • It also has goals and plugin • It contains information of project and configuration information for the maven to build the project such as dependencies, build directory, source directory, test source directory, plugin, goals etc. • Maven reads the pom.xml file, then executes the goal.
  • 26. STRUCTURE OF MAVEN POM.XML FILE • Project • It is the root element of pom.xml file. • Model version • It is the sub element of project. • It specifies the model Version. • It should be set to 4.0.0. • Group id • It is the sub element of project. • It specifies the id for the project group.
  • 27. • Artifact id • It specifies the id for the artifact. • Artifact is something that is either produced or used by a project. • Examples JARs, source and binary distributions, and WARs. • Version • It specifies the version of the artifact under given group. • Packaging • Defines packaging type such as jar, war etc. • Name • Defines name of the maven project.
  • 28. • Dependies • Defines dependencies for this project. • Dependency • Defines a dependency. It is used inside dependencies. • Scope • Defines scope for this maven project. It can be compile, provided, runtime, test and system.
  • 29. JAVA PROGRAM USING MAVEN package maven.selenium.testng; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; public class DemoClass { @Test public void test() throws InterruptedException { System.setProperty("webdriver.chrome.driver","C:UsersArvind PhulareDesktopchromedriver.exe"); WebDriver driver = new ChromeDriver(); String baseUrl = "<a href="http://newtours.demoaut.com/">http://newtours.demoaut.com/</a>"; String expectedTitle = "Welcome: Mercury Tours";
  • 30. String actualTitle = ""; driver.get(baseUrl); actualTitle = driver.getTitle(); Thread.sleep(3000); if (actualTitle.contentEquals(expectedTitle)){ System.out.println("Test Passed!"); } else { System.out.println("Test Failed"); } driver.close(); } }
  • 31. HOW TO INSTALL MAVEN IN ECLIPSE • Open Eclipse ID and click help and go to install new software. • Then opened, click on the Add button to add a new repository.
  • 32. • Fill the name and location information Add repository box • Then click ok.
  • 33. • After pending finished, select all and click next. • Accept the terms of the license agreement and click Finish • At the end of the installation, restart your Eclipse. Click Yes to perform the restart.
  • 34. CREATE MAVEN PROJECT IN ECLIPSE