Maven Installation and Setup Guide
Pre-Requisites
- Java (JDK) must be installed
Download Maven
- Go to the Maven Download Page:
- Download Binary Zip Archive:
- Click on
apache-maven-3.9.7-bin.zipto download the zip file. - Extract the zip file by right-clicking on
apache-maven-3.9.7-bin.zipand selectingExtract to apache-maven-3.9.7-bin.zip. - This will create a new folder named
apache-maven-3.9.7-bin.
- Click on
Set Environment Variables
Set JAVA_HOME:
- Variable name:
JAVA_HOME - Variable value:
C:\Program Files\Java\jdk-11.0.15.1(Adjust this path to where JDK is installed on your system)
- Variable name:
Set MAVEN_HOME:
- Variable name:
MAVEN_HOME - Variable value:
C:\brahma\seleniumSoftwares\apache-maven-3.9.7-bin
- Variable name:
Add to PATH Environment Variable:
- Add the following to the
PATHvariable:%JAVA_HOME%\bin %MAVEN_HOME%\bin
- Add the following to the
Steps to Add Environment Variables
Press the
Windowsbutton on your keyboard and typeenvironment variables.Select
Edit the system environment variables.In the
System Propertieswindow, click theEnvironment Variablesbutton.In the
Environment Variableswindow, click theNewbutton under theSystem variablessection.To add
JAVA_HOME:- Enter
JAVA_HOMEas the variable name. - Enter
C:\Program Files\Java\jdk-11.0.15.1as the variable value (Adjust as necessary). - Click
OK.
To add
MAVEN_HOME:- Enter
MAVEN_HOMEas the variable name. - Enter
C:\brahma\seleniumSoftwares\apache-maven-3.9.7-binas the variable value. - Click
OK.
- Enter
To update the
Pathvariable:- Find and select the
Pathvariable in theSystem variablessection, then clickEdit. - Click
Newand add%JAVA_HOME%\bin. - Click
Newagain and add%MAVEN_HOME%\bin. - Click
OK.
- Find and select the
Verify Maven Installation
Open the Run dialog by pressing
Win + R, typecmd, and pressEnterto open the Command Prompt.Check Java version:
java -versionExample output:
java version "11.0.15.1" 2022-04-22 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.15.1+2-LTS-10) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.15.1+2-LTS-10, mixed mode)Check Maven version:
mvn -versionExample output:
Apache Maven 3.9.7 (xxxxx) Maven home: C:\brahma\seleniumSoftwares\apache-maven-3.9.7-bin Java version: 11.0.15.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.15.1 Default locale: en_IN, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"Verify environment variables:
To check
JAVA_HOME:echo %JAVA_HOME%Expected output:
C:\Program Files\Java\jdk-11.0.15.1To check
MAVEN_HOME:echo %MAVEN_HOME%Expected output:
C:\brahma\seleniumSoftwares\apache-maven-3.9.7-bin
Add Maven Plugin in Eclipse
- Open Eclipse.
- Go to
Help>Eclipse Marketplace. - In the
Eclipse Marketplacewindow, typemavenin the search box and pressEnter. - Select the
Maven m2eplugin and click theInstallbutton. - Follow the prompts to complete the installation.
Verify Maven Plugin in Eclipse
- Go to
Help>Eclipse Marketplace. - Check the
Installedtab forMaven integrationand other plugins like TestNG, Git, Cucumber.
Summary
Download JDK and Maven.
Set environment variables:
JAVA_HOMEMAVEN_HOME- Update
Pathto include%JAVA_HOME%\binand%MAVEN_HOME%\bin.
Verify installations:
- Check Java version with
java -version. - Check Maven version with
mvn -version. - Verify
JAVA_HOMEandMAVEN_HOMEpaths.
- Check Java version with
Install Maven plugin in Eclipse.
For more detailed steps and troubleshooting, refer to Mkyong's Maven installation guide.
No comments:
Post a Comment